2

Afternoon All,

I have spent a good chunk of my time on the internet tryiong to solve the below issue but im getting myself a little confused. I am new to .net and im working in VS 2010.

Im trying to get a simple calendar to work with an image and a text box. I have the AjaxControlToolkit.dll (Version 3.5). I the following error when trying to get this calender to work:

Unable to cast object of type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection' to type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection'.

Here is my .aspx code (Which has a blue line right at the top of the page which states that there is a system.we.extensions error, but i already have this in my web config file?)

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <!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"> <cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></cc1:ToolkitScriptManager> <div> <asp:ImageButton runat="Server" ID="ImageButton1" ImageUrl="~/images/calendar.gif" AlternateText="Click here to display calendar" /> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <cc1:calendarextender ID="CalendarExtender1" runat="server" TargetControlID="TextBox1" PopupButtonID="ImageButton1"> </cc1:calendarextender> </div> </form> </body> </html> 

And here is my web config file:

<?xml version="1.0"?> <configuration> <appSettings/> <connectionStrings> <add name="TestConn" connectionString="Data Source=Server1;Initial Catalog=CatalogName;User ID=UserID;Password=Password" providerName="System.Data.SqlClient"/> </connectionStrings> <system.web> <compilation debug="true"> <assemblies> <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"></add> <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"></add> </assemblies> </compilation> <authentication mode="Windows"/> <customErrors mode="Off"/> <httpModules></httpModules> <pages> <controls> <add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="cc1" /> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </controls> </pages> </system.web> </configuration> 

Many Thanks in advance.

Regards Betty

1 Answer 1

1

You are adding the System.Web.Extensions section twice:

 <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 

Remove one of them.

After you do that, you'll probably have some compilation errors. Just adjust the using statements to point to the appropriate namespace.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the response but i have removed the following tagPrefix but i still have the same error? <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
@Betty Try removing the assembly attribute from the one that's left; in other words, just use this: <add tagPrefix="asp" namespace="System.Web.UI.WebControls" />

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.