	<script language="c#" runat="server">
	void btn_click(object sender,EventArgs e){
		SCalendar.Visible=true;//打开月历
		btn.Visible=false;//隐藏选择日期
		OK.Visible=true;//显示确定
		cel.Visible=true;//显示取消
	}
	public string NowDate{
		get{
			return InputDate.Text;
		}
		set{
			if(value != "" ){
				SCalendar.SelectedDate = Convert.ToDateTime(value);
				InputDate.Text = value;
			}
			else{
				SCalendar.SelectedDate = DateTime.Now;
			}
		}
	}
	void ok_click(object sender,EventArgs e){
		SCalendar.Visible=false;
		btn.Visible=true;
		OK.Visible=false;
		cel.Visible=false;
		InputDate.Text=SCalendar.SelectedDate.ToString("yyyy/MM/dd");
	}
	void cel_click(object sender,EventArgs e){
		SCalendar.Visible=false;
		btn.Visible=true;
		OK.Visible=false;
		cel.Visible=false;
	}
	</script>
        <asp:textbox Columns="10" Runat="server" id="InputDate" />
<asp:Button Text="选择日期" id="btn" Runat="server" onclick="btn_click" />
   <asp:CustomValidator id="CustomValidator1" runat="server"
      ControlToValidate="InputDate"
      ClientValidationFunction="CheckDate">
   </asp:CustomValidator>
        <asp:Calendar id=SCalendar Visible="false" runat="server"
            BackColor="lightyellow"
            DayNameFormat="Short"
            SelectionMode="Day"
            Font-Name="Verdana;Arial" Font-Size="11px"
            Height="110px" Width="180px"
            TodayDayStyle-Font-Bold="true"
            DayHeaderStyle-Font-Bold="true"
            OtherMonthDayStyle-ForeColor="gray"
            TitleStyle-BackColor="#3366ff"
            TitleStyle-ForeColor="white"
            TitleStyle-Font-Bold="true"
            SelectedDayStyle-BackCoor="#ffcc66"
            SelectedDayStyle-Font-Bold="true"
            NextMonthText = "Next"
            PrevMonthText = "Prev"
            SelectorStyle-BackColor="#99ccff"
            SelectWeekText = "<img src=//selweek.gif// border=0 onmouseover=this.style.backgroundColor=//#ffcc66// onmouseout=this.style.backgroundColor=//#99ccff//>"
            SelectMonthText = "<img src=//selmonth.gif// border=0 onmouseover=this.style.backgroundColor=//#ffcc66// onmouseout=this.style.backgroundColor=//#99ccff//>"
            />
<asp:Button Text="确定" id="OK" Runat="server" Visible="false" onclick="ok_click" />
<asp:Button Text="取消" id="cel" Runat="server" Visible="false" onclick="cel_click" />
<script language=vbscript>
Function CheckDate(source, value)
If IsDate(value.value) = false  Then
	Msgbox "日期输入错误"
end if
End Function
</script>