如何在单个页面中使用多个 ajax 日历

How to use multiple ajax calendars in a single page

我正在尝试使用日历来插入日期。不幸的是,我不得不使用多个日历。为了从日历中提取日期,我使用 Ajax 工具包

`<cc1:ToolkitScriptManager ID="ToolkitScriptManager1"  EnableScriptGlobalization="true" EnableScriptLocalization="true" runat="server">
            </cc1:ToolkitScriptManager>

<asp:TextBox ID="DateOfPurchase" runat="server"  Height="30px" ReadOnly="true" Width="262px"></asp:TextBox>

            <asp:ImageButton ID="imgPopup" ImageUrl="images/index.jpg" ImageAlign="Bottom"
            runat="server" Height="27px" Width="37px" />

            <cc1:CalendarExtender ID="Calendar1" PopupButtonID="imgPopup" runat="server" TargetControlID="DateOfPurchase"
            Format="dd/MM/yyyy">
            </cc1:CalendarExtender>`

所以每当我添加多个 <cc1:ToolkitScriptManager ID="ToolkitScriptManager1" EnableScriptGlobalization="true" EnableScriptLocalization="true" runat="server"> </cc1:ToolkitScriptManager> 我的程序显示错误。 如果我只使用一个 ToolkitScriptManager 和多个 Ajax 日历控件,则只单击一个用于显示日历的图像按钮,弹出页面上的所有日历。

每个 CalendarExtender 必须有自己的 ID

        <asp:ImageButton ID="imgPopup1" ImageUrl="images/index.jpg" ImageAlign="Bottom"
        runat="server" Height="27px" Width="37px" />

        <cc1:CalendarExtender ID="Calendar1" PopupButtonID="imgPopup1" runat="server" TargetControlID="DateOfPurchase1"
        Format="dd/MM/yyyy">
        </cc1:CalendarExtender>`

        <asp:ImageButton ID="imgPopup2" ImageUrl="images/index.jpg" ImageAlign="Bottom"
        runat="server" Height="27px" Width="37px" />

        <cc1:CalendarExtender ID="Calendar2" PopupButtonID="imgPopup2" runat="server" TargetControlID="DateOfPurchase2"
        Format="dd/MM/yyyy">
        </cc1:CalendarExtender>`