Hello friends,
I am using telerik version 2013.1.417.40 and all I that I want to do with my RadDatePicker for ASP.net AJAX control is, I want to set max date on client side ( the existing value may be violating this constraint )
Below is the markup :
the code below works fine ... except the line in bold font face :
I referred ... http://demos.telerik.com/aspnet-ajax/calendar/examples/datepicker/clientapi/defaultcs.aspx
I am using telerik version 2013.1.417.40 and all I that I want to do with my RadDatePicker for ASP.net AJAX control is, I want to set max date on client side ( the existing value may be violating this constraint )
Below is the markup :
<telerik:RadDatePicker ID="dtMyDate" Width="157px" runat="server" MinDate="1/1/0001 12:00:00 AM" CssClass="telerikScroll"> <DateInput ID="DateInput2" runat="server" DateFormat="MM/dd/yyyy"> </DateInput></telerik:RadDatePicker>the code below works fine ... except the line in bold font face :
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"> <script src="../Scripts/jquery-1.9.1.min.js" type="text/javascript"></script> <script type="text/javascript" defer="defer"> $(document).ready(function () { var objMyDate = $('#<%=dtMyDate.ClientID%>'); var MyDate = objMyDate.val(); MyDate = MyDate.toString().split("-"); MyDate = new Date(MyDate[0], MyDate[1], MyDate[2]); var currentDate = new Date(); if (MyDate > currentDate) { alert('Please, correct the date !'); objMyDate.set_maxDate(currentDate); } }); </script></asp:Content>I referred ... http://demos.telerik.com/aspnet-ajax/calendar/examples/datepicker/clientapi/defaultcs.aspx
- but this line gives an error, saying set_maxDate function does not exist :
objMyDate.set_maxDate(currentDate); - Additionally, date_picker object was staying null in the following code snippet
var date_picker = $find("<%= dtMyDate.ClientID %>");date_picker.set_maxDate(new Date());