disable future dates in calendar extender control
-
Hi Freinds I am using CalendarExtendar Control of AjaxControlToolKit. now i need to disable all dates which is greater then today's date. is this possible? if yes let me know. please reply if u have other way to hide future date in calendar control thanks Regards Keyur Satyadev
-
Hi Freinds I am using CalendarExtendar Control of AjaxControlToolKit. now i need to disable all dates which is greater then today's date. is this possible? if yes let me know. please reply if u have other way to hide future date in calendar control thanks Regards Keyur Satyadev
Hope this will help you <pre> <head runat="server"> <title>Calendar Extender</title> <script type="text/javascript"> function checkDate(sender,args) { if (sender._selectedDate > new Date()) { alert("You cannot select a day greater than today!"); sender._selectedDate = new Date(); // set the date back to the current date sender._textbox.set_Value(sender._selectedDate.format(sender._format)) } } </script> </head> Call the code: <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <cc1:CalendarExtender ID="CalendarExtender1" runat="server" OnClientDateSelectionChanged="checkDate" TargetControlID="TextBox1" /> </div> </form> </pre>
-
Hope this will help you <pre> <head runat="server"> <title>Calendar Extender</title> <script type="text/javascript"> function checkDate(sender,args) { if (sender._selectedDate > new Date()) { alert("You cannot select a day greater than today!"); sender._selectedDate = new Date(); // set the date back to the current date sender._textbox.set_Value(sender._selectedDate.format(sender._format)) } } </script> </head> Call the code: <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <cc1:CalendarExtender ID="CalendarExtender1" runat="server" OnClientDateSelectionChanged="checkDate" TargetControlID="TextBox1" /> </div> </form> </pre>
Thanks for Reply.
-
Thanks for Reply.
it is not working , what parameters do i give whole calling the java script function in the extender control : for the check Date Function what Arguments do I give while calling , as my java script function is not letting the calendar control work . function checkDate(sender, args) { alert('WHAT'); 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)) } }
Fad .