<script type="text/javascript">
function checkDate(sender, args) {
if (sender._selectedDate > new Date()) {
alert("You cannot select a day Greater than today!");
sender._selectedDate = new Date();
// set the date back to the current date
sender._textbox.set_Value(sender._selectedDate.format(sender._format))
}
</script>
Design:
<asp:TextBox ID="txt_FDate" runat="server" Width="100px"></asp:TextBox>
<img id="calendar_Img1" src="Images/calendar.gif" alt="Calendar" />
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txt_FDate"
CssClass="cal_Theme1" Format="yyyy-MM-dd" PopupButtonID="calendar_Img1" OnClientDateSelectionChanged="checkDate">
</cc1:CalendarExtender>
function checkDate(sender, args) {
if (sender._selectedDate > new Date()) {
alert("You cannot select a day Greater than today!");
sender._selectedDate = new Date();
// set the date back to the current date
sender._textbox.set_Value(sender._selectedDate.format(sender._format))
}
</script>
Design:
<asp:TextBox ID="txt_FDate" runat="server" Width="100px"></asp:TextBox>
<img id="calendar_Img1" src="Images/calendar.gif" alt="Calendar" />
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txt_FDate"
CssClass="cal_Theme1" Format="yyyy-MM-dd" PopupButtonID="calendar_Img1" OnClientDateSelectionChanged="checkDate">
</cc1:CalendarExtender>