In need to disable previous date selection from ajax calender extender.
<asp:TextBox ID="txtFromDate" runat="server" CssClass="text_box left w80"></asp:TextBox><asp:ImageButton ID="fromDatePicker" CssClass="datepicker" runat="server" CausesValidation="false"
ImageUrl="~/images/datepicker.png"></asp:ImageButton><ajaxToolkit:CalendarExtender ID="fromDateCalendarExtender" runat="server" EnabledOnClient="true"
PopupButtonID="fromDatePicker" TargetControlID="txtFromDate" OnClientDateSelectionChanged="checkForPreviousDate"></ajaxToolkit:CalendarExtender>I am using the below given js function
<script type="text/javascript">
// Do not move this to top script tag..it wil throw js error if moved to top
function checkForPreviousDate(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>But the code to set the date back to current date is not working and it gives a js error- sender._textbox is undefined.
sender._textbox.set_Value(sender._selectedDate.format(sender._format));
Any idea to set the current date and remove the js error?