Search code examples
asp.netvb.netcalendarextender

Ajax Toolkit ASP.NET (Visual Basic) Not Displaying Calendar


I'm trying to use Ajax Toolkit in ASP.NET page to display a Calendar Extender with this code, but it's not working for me.

<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<br />
<br />
<b>Calendar :</b><br />
    <asp:TextBox ID="Date1" runat="server"></asp:TextBox>
    <asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="Date1">
    </asp:CalendarExtender>
</div>
</form>

It's not displaying the calendar.

What's the problem ?


Solution

  • Try:

    <ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="Date1">
    </ajaxToolkit:CalendarExtender>
    

    Update:

    Do you have the following in your web.config?

        <pages>
          <controls>
            <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="asp" />
          </controls>
        </pages>
    
        <compilation>
            <assemblies>
                <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            </assemblies>
        </compilation>
    
        <httpHandlers>
            <remove verb="*" path="*.asmx" />
            <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
        </httpHandlers>
    
        <httpModules>
            <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        </httpModules>
    

    Update II

    Put the following at the top of your aspx page.

    <%@ Register Tagprefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" %>
    

    Also, you're referencing AjaxControlToolkit.dll, right? It should be in your bin directory. Right-click project, Add Reference menu choice to add.