jquerytelerikasp.net-4.0raddatepicker

cant get selected date of rad date picker using jquery


I have the following definition of rad date picker:

 <telerik:RadDatePicker ID="calStartUsingDate"  runat="server" DateFormat="dd/MM/yyyy">
                            <ClientEvents OnDateSelected="calcConsump" />
                        </telerik:RadDatePicker>  

I tried to get the selected date of it, but the following statment always returns null !!

 start = $find("<%=calStartUsingDate.ClientID %>"); 

Solution

  • Use this outside of your OnDateSelected function:

    var start = $find("<%=calStartUsingDate.ClientID %>").get_selectedDate();
    

    OR if you are using it in the OnDateSelected function it would look something like...

    function calcConsump(sender, args){
        var start = sender.get_selectedDate();
    }
    

    http://www.telerik.com/help/aspnet-ajax/calendar-client-side-rad-datepicker.html