6

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?

Pavel Chuchuva
  • 22,633
  • 10
  • 99
  • 115
Aviran Cohen
  • 5,581
  • 4
  • 48
  • 75

2 Answers2

1

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>
alejandrobog
  • 2,091
  • 14
  • 20
  • I tried it now and I got an error: Error 1 Unknown server tag 'act:ConfirmButtonExtender'. C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\WebSites\WebSite1\Default.aspx 12 – Aviran Cohen Jun 04 '10 at 20:27
  • Do you add a reference to your AjaxControlToolkit.dll in your project and the tagPrefix in your web config? (The first 2 steps i write below) – alejandrobog Jun 04 '10 at 20:29
  • I installed the AJAX ToolKit controls if that what you mean by "a reference to your AjaxControlToolkit.dll", and I added the tagPrefix as you wrote it. – Aviran Cohen Jun 04 '10 at 21:03
  • I installed AJAX ToolKit to the Toolbox, so I am not so sure if that is what you mean. – Aviran Cohen Jun 04 '10 at 21:08
0
  • 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

Community
  • 1
  • 1
Tim Schmelter
  • 450,073
  • 74
  • 686
  • 939
  • What Visual Studio Version? I have Visual Studio 2005. Have you created an Ajax enabled Website? I tried creating it, but I had no option to. I searched for an answer over the internet but I coudn't find it. Have you installed an earlier Toolkit Version as 3.5 before? Yes. Have you added a reference to the AjaxControlToolkit.dll to the Project? I added the ToolKit to my toolbox by selecting the AjaxControlToolkit.dll file. What do you mean by adding a reference to this project? and how can I do that? – Aviran Cohen Jun 04 '10 at 21:07