<script type="text/ecmascript">
function checkDates(sender, args) {
// alert(sender._selectedDate + " enter " + new Date());
if (sender._selectedDate > new Date()) {
alert('Date must be less than Today');
sender._selectedDate = new Date();
// set the date back to the current date
sender._textbox.set_Value(sender._selectedDate.format(sender._format))
}
}
</script >
//HTML
<asp:TextBox runat="server" ID="dtForm" Enabled="False" ></asp:TextBox>
<asp:CalendarExtender ID="CalendarExtender1" runat="server" PopupButtonID="cal_Surveyor"
TargetControlID="dtForm" OnClientDateSelectionChanged="checkDates" Enabled="True" Format="dd/MM/yyyy"></asp:CalendarExtender>
function checkDates(sender, args) {
// alert(sender._selectedDate + " enter " + new Date());
if (sender._selectedDate > new Date()) {
alert('Date must be less than Today');
sender._selectedDate = new Date();
// set the date back to the current date
sender._textbox.set_Value(sender._selectedDate.format(sender._format))
}
}
</script >
//HTML
<asp:TextBox runat="server" ID="dtForm" Enabled="False" ></asp:TextBox>
<asp:CalendarExtender ID="CalendarExtender1" runat="server" PopupButtonID="cal_Surveyor"
TargetControlID="dtForm" OnClientDateSelectionChanged="checkDates" Enabled="True" Format="dd/MM/yyyy"></asp:CalendarExtender>
No comments:
Post a Comment