AjaxControlToolKit CalendarExtender(日历扩展控件)的使用方法

     设置CalendarExtender的TargetControlID为需要显示日期的TextBox的ID,textBox控件的readOnly属性设置为 false ,这样就可以点击textbox控件就会出来一个日历控件。代码如下:

     <asp:ScriptManager ID="ScriptManager1" runat="server"
EnableScriptGlobalization="True" EnableScriptLocalization="True">

</asp:ScriptManager>
<ajaxToolkit:CalendarExtender
Format="yyyy-MM-dd" ID="CalendarExtender2"
runat="server"
TargetControlID="TextBox1" >
</ajaxToolkit:CalendarExtender>

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

    CalendarExtender的 Format属性设置 时间的显示格式
另:PopupButtonID属性是设置一个button控件的ID
点击该控件则展开calendarExtender
如下:

<asp:ScriptManager ID="ScriptManager1" runat="server"
EnableScriptGlobalization="True" EnableScriptLocalization="True">

</asp:ScriptManager>
<cc1:CalendarExtender
ID="CalendarExtender1" runat="server" TargetControlID="TextBox1"
PopupButtonID="ImageButton1" >
</cc1:CalendarExtender>

<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox><asp:ImageButton ID="ImageButton1"

runat="server" />

原文地址:https://www.cnblogs.com/deng-c-q/p/4468122.html