Hi I am trying to install the ajax controll toolkit in an asp.net project.I have used Nugget to download the library into the project and loaded each control into the toolbox but when I try to use any of the controls I get this error:
Error 3 The type 'System.Web.UI.Design.ExtenderControlDesigner' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. D:\Projects IDE\Visual Studio\C# Book\ASP.NET\WebSite12\Default.aspx 14
After reading this error I added this in the configuration file:
<assemblies>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblies>
I understand that this should point to the assembly I need but it does not work and also maybe someone can tell me from where should I have goten this string in the first place I have seen similar strings used for providersi in asp.net at the type property and I cant understand from where should I get them especialy the PublicKeyToken.
This is my entire code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:AlwaysVisibleControlDesigner ID="AlwaysVisible" runat="server">
</asp:AlwaysVisibleControlDesigner>
</form>
</body>
</html>
And this is the contents of the web.config file:
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="false" targetFramework="4.0" >
<assemblies>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblies>
</compilation>
<pages>
<controls>
<add tagPrefix="asp" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
</controls>
</pages>
</system.web>
</configuration>
Also a second configuration file has been added after installing the ajax control toolkit via nugget called packages.config:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AjaxControlToolkit" version="4.1.60919" targetFramework="net40" />
</packages>
What am I doing wrong here?Why am I getting that error?
EDIT
It turns out I had to add an aditional assembly for this to work:
<assemblies>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</assemblies>
Now I am getting an error that says:
**Error 2 Type 'AjaxControlToolkit.AlwaysVisibleControlDesigner' does not have a public property named 'TargetControlID'. D:\Projects IDE\Visual Studio\C# Book\ASP.NET\WebSite12\Default.aspx 14
**
This is the code:
<asp:AlwaysVisibleControlDesigner ID="AlwaysVisible" runat="server" TargetControlID="Panel1" HorizontalOffset="10" HorizontalSide="Right" VerticalOffset="10" >
</asp:AlwaysVisibleControlDesigner>
I am prety sure that this should be corect I got this example from the book Proffesional asp.net in C# and VB
Somehow my code is not getting the ajaxcontrol toolkit properties.How can I corect this?