Compilation Error when using AJAX Control From AJAX ToolKit
I tried using AJAX Control for my first time after I installed the AJAX Toolkit for ASP.NET. I created a new ASP.NET website and added the ConfirmButtonExtender. After I run it without changing anything I get this error:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.Compiler Error Message: CS0012: The type 'System.Web.UI.ExtenderControl' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3开发者_如何学Go856ad364e35'.
Source Error:
Line 16: <br />
Line 17: <asp:Label ID="Label1" runat="server" Text="Label" Width="229px"></asp:Label><br />
**Line 18: <asp:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server"** ConfirmText="are you sure"
Line 19: TargetControlID="Button1">
Line 20: </asp:ConfirmButtonExtender>
I tried connecting this Control with a button as I saw in a tutorial video or adding the ToolkitScriptManager but it gave me the same error.
Does anyone know how can I solve this error?
The ConfirmButtonExtender is not under System.Web.Extensions.
First you need to add a reference to your AjaxControlKit in your project. Then you can add the controls on your web config something like this:
<pages>
<controls>
....
<add tagPrefix="act" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit"/>
</controls>
</pages>
Once you've done this the you can use your ajax control like in the following example:
<act:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" ConfirmText="are you sure"
TargetControlID="Button1">
</act:ConfirmButtonExtender>
- What Visual Studio Version?
- Have you created an Ajax enabled Website?
- Have you installed an earlier Toolkit Version as 3.5 before?
- Have you added a reference to the AjaxControlToolkit.dll to the Project?
Have a look here: How do I install and use the ASP.NET AJAX Control Toolkit in my .NET 3.5 web applications? and here: http://msdn.microsoft.com/en-us/library/bb386580.aspx
精彩评论