使用 asp.net 中的下拉列表更改日历扩展器的日期格式



我想制作一个程序,允许您选择要使用的日期格式。我不知道如何在扩展器中选择日期后更改日历扩展器的日期格式属性,具体取决于我在DropDownList1中选择的格式。我应该使用OnClientDateSelectionChanged()但它只在客户端中运行,有没有办法使用 JavaScript 更改扩展器的日期格式属性?请帮忙。

<asp:ImageButton ID="imgPopup" ImageUrl="images/calendar.png" ImageAlign="Bottom" runat="server" />
<cc1:CalendarExtender ID="Calendar1" PopupButtonID="imgPopup" runat="server" TargetControlID="txtDate">
</cc1:CalendarExtender>
<asp:DropDownList id="DropDownList1" runat="server">
   <asp:ListItem value="value">
      dd/MM/yyyy
   </asp:ListItem>
<asp:ListItem value="value1">
      MM/dd/yyyy
 </asp:ListItem>
</asp:DropDownList>

尝试使用此代码来更改模板。它对我有用。

<ajax:CalendarExtender ID="CEtxtFromDueDate" runat="server" Enabled="True"  
 CssClass="cal_Theme1" Format="dd/MM/yyyy" PopupButtonID="txtFromDueDate" 
 TargetControlID="txtFromDueDate">

最新更新