Asp.Net Ajax Calendar Control Validation For Date

To make Validation for Ajax Calendar so that usec cannot install Greater than or Less than Todays; date

This exammple demonstates Date Must not greater than Today’s Date

<asp:TextBox CssClass=”stdtextboxwidth” ID=”txtDate” runat=”server” Width=”180px”></asp:TextBox>
<cc1:CalendarExtender ID=”CalendarExtender1″ runat=”server” TargetControlID=”txtDate”
PopupButtonID=”imgDate” OnClientDateSelectionChanged=”checkDate”>
</cc1:CalendarExtender>
<img alt=”Calendar” src=”images/Calendar.png” id=”imgDate” />

Put Following Code into Javascript
<script type=”text/javascript”>
function checkDate(sender,args)
{
var dt = new Date();
if(sender._selectedDate > dt)
{
sender
._textbox
.set_Value(dt.format(sender._format));
alert(“You cannot Select Date Greater than Today”);
}

}
</script>