<
asp:TextBox runat
=
"
server
"
ID
=
"
TextBox1
"
MaxLength
=
"
10
"
></
asp:TextBox
><
asp:ImageButton ID
=
"
ImageButton1
"
runat
=
"
server
"
SkinID
=
"
CalendarImageButton
"
OnClientClick
=
"
javascript:return false;
"
/><
ajaxToolkit:CalendarExtender runat
=
"
server
"
TargetControlID
=
"
TextBox1
"
CssClass
=
"
ajaxToolkit-CalendarExtender
"
Format
=
"
MM/dd/yyyy
"
PopupButtonID
=
"
ImageButton1
"
id
=
"
CalendarExtender1
"
/>
1.使用CalendarExtender控件的页面,必需包括Ajax Extensions控件ScriptManager;
2.CalendarExtender控件的属性Format可定制日期显示格式,默认值为"d",显示为"1/25/2007".如果要定制日期格式为"2007-01-25",应使用字符串"yyyy-MM-dd",而不是"yyyy-mm-dd";
3.如上图所示,若想从TextBox控件中取到日期值,请保证TextBox控件的ReadOnly属性的值为"false",若设置为"true",将无法从TextBox控件中取到值.
4.注意TargetControlID, PopupButtonID的属性.