使用方法很簡單,就不囉嗦那麼多了 翻譯過來就是 日曆擴展控件吧 配合TextBox控件使用只要TextBox獲的焦點就會顯示出來日曆
例子:只需要設置CalendarExtender的TargetControlID爲需要顯示日期的TextBox的ID即可以,textBox控件的readOnly屬性設置爲 false
主要代碼:
- <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" />
ScriptManager的EnableScriptGlobalization屬性 和EnableScriptLocalization屬性設置爲 true則 控件爲中文
具體ScriptManager的屬性方法還在學習中。