Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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=31bf3856ad364e35'.

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?

like image 935
Aviran Cohen Avatar asked Jun 04 '10 20:06

Aviran Cohen


1 Answers

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>
like image 187
alejandrobog Avatar answered Nov 13 '22 20:11

alejandrobog