Restricting User Not to Select Previous Dates in Calander Control

<script type="text/javascript">
function checkDate(sender,args)
{
   if (sender._selectedDate < new Date())
     {
        alert("You cannot select a day earlier than today!");
        sender._selectedDate = new Date();
        // set the date back to the current date
        sender._textbox.set_Value(sender._selectedDate.format(sender._format))
}
}
</script>

<ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtfrmdate" 
OnClientDateSelectionChanged="checkDate">
</ajaxToolkit:CalendarExtender>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s