disabled past/previous dates from todays in Ajaxtoolkit calendar extendar?
disabled past dates from todays date// in Ajaxtoolkit calendar extendar ..开发者_运维百科.and show selected dates in format as 4-Dec-2010
To prevent selecting dates earlier than today, add a JavaScript function:
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))
}
}
Then hook it up to the Calendar Extender:
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<cc1:CalendarExtender ID="CalendarExtender1"
runat="server" OnClientDateSelectionChanged="checkDate" TargetControlID="TextBox1" />
You will also need a Validator to ensure the user does not manually set an invalid date.
精彩评论