Ajax 工具包 ASP.NET (Visual Basic) 不显示日历

发布于 2024-09-03 18:46:15 字数 567 浏览 5 评论 0原文

我尝试在 ASP.NET 页面中使用 Ajax Toolkit 来显示带有此代码的日历扩展器,但它对我不起作用。

<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>

它不显示日历。

有什么问题吗?

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 ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

倾城月光淡如水﹏ 2024-09-10 18:46:15

尝试:

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

更新:

您的 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>

更新 II

将以下内容放在您的 aspx 页面的顶部。

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

另外,您引用的是 AjaxControlToolkit.dll,对吗?它应该位于您的 bin 目录中。右键单击项目,选择Add Reference菜单进行添加。

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.

残月升风 2024-09-10 18:46:15

您是否已为 CalendarExtender 添加了 Register 指令?

<%@ Register TagPrefix="asp" TagName="CalendarExtender" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" %>

(或者像 Steve 建议的那样将其添加到 web.config 中)

您是否添加了对 AjaxControlToolkit dll 的程序集引用?

Have you added a Register directive to your page for the CalendarExtender?

<%@ Register TagPrefix="asp" TagName="CalendarExtender" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" %>

(Or added it in web.config like Steve suggested)

Have you added an assembly reference to the AjaxControlToolkit dll?

情释 2024-09-10 18:46:15

嗯,这是由 ScriptManager 引起的。我有同样的问题。解决方案非常简单,只需从页面或您放置的位置删除 ScriptManager,

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

即删除 scriptmanager 后,只需放置 ToolkitscriptManager 或下面的代码:

<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</ajaxToolkit:ToolkitScriptManager>

您可以在工具栏 -> 中找到它ajax 选项卡不在 Ajax 扩展选项卡中。我希望它能解决你的问题

Well it is caused by ScriptManager. I have this same issue. The solution is very simple just delete ScriptManager From page or where you placed i.e.

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

Once you delete scriptmanager then just place ToolkitscriptManager or below code:

<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</ajaxToolkit:ToolkitScriptManager>

You can find this in toolbar -> ajax tab not in Ajax Extensions tab. I hope it will solve your issue

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文