2017-07-08 78 views
0

我正在尝试使用日历来插入日期。不幸的是,我必须使用多个日历。对于从日历中提取日期,我使用Ajax工具包如何在单个页面中使用多个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日历控件,只需单击一个图像按钮以显示日历,则会弹出页面上的所有日历。

回答

1

每个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>` 
+0

非常感谢!!有效。 – saurabh

相关问题