	<script language="VB" runat="server">
	sub btn_click(sender as object,e as EventArgs)
		SCalendar.Visible=true'打开月历
		btn.Visible=false'隐藏选择日期
		OK.Visible=true'显示确定
		cel.Visible=true'显示取消
	end sub
	public Property NowDate() as string
		get
			return InputDate.Text
		end get
		set
			if value <> "" then
				SCalendar.SelectedDate = Convert.ToDateTime(value)
				InputDate.Text = value
			else
				SCalendar.SelectedDate = DateTime.Now
			end if
		end set
	end property
	sub ok_click(sender as object,e as EventArgs)
		SCalendar.Visible=false
		btn.Visible=true
		OK.Visible=false
		cel.Visible=false
		InputDate.Text=SCalendar.SelectedDate.ToString("yyyy/MM/dd")
	end sub
	sub cel_click(sender as object,e as EventArgs)
		SCalendar.Visible=false
		btn.Visible=true
		OK.Visible=false
		cel.Visible=false
	end sub
	</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="VerdanaArial" 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>