Any advice to retrieve selected date on client-side

3 posts, 1 answers
  1. Utku Ozan
    Utku Ozan avatar
    8 posts
    Member since:
    Feb 2008

    Posted 03 Mar 2010 Link to this post

    I am using Telerik Rad Controls 2008 Q3 in my bussiness. In an application I need to copy the selected date of a RadDatePicker to another. I can access the objects with thie client side ID's. But the problem is I do not have a clien-side event to handle this process. Currently the RadDatePicker has only OnPopUpOpening, OnPopUpClosing and  OnDateSelected event of which OnDateSelected is the only useful one. I can catch the date whenever it is typed manually with client-side "onchange" event. But I want to access the value whenever the user selectes the date via the monthly view. But "OnDateSelected" event fires before the value is set to textbox of the calendar.

    So, how can I copy the context on a Calendar-Text Box when the value is set by using the pop-up calendar?

    Regards.
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 03 Mar 2010 Link to this post

    Hi Utku Ozan,

    Try the following code and see whether it suits your need.

    aspx:
     
        <telerik:RadDatePicker ID="RadDatePicker1" runat="server"
            <ClientEvents OnDateSelected="OnDateSelected" />         
        </telerik:RadDatePicker> 
        <telerik:RadDatePicker ID="RadDatePicker2" runat="server"
        </telerik:RadDatePicker> 

    javascript:
     
    <script type="text/javascript"
        function OnDateSelected(sender, args) { 
            var dt = sender.get_selectedDate(); 
            var myDate = new Date(sender.get_selectedDate().format("MM/dd/yyyy")); 
            var datepicker = $find("<%= RadDatePicker2.ClientID %>"); 
            datepicker.set_selectedDate(myDate); 
        } 
    </script> 
    You can find out more client methods and properties in the following documentation.
    RadDatePicker Client Object

    Thanks,
    Princy.
  3. Utku Ozan
    Utku Ozan avatar
    8 posts
    Member since:
    Feb 2008

    Posted 03 Mar 2010 Link to this post

    That has been great help in absolutely no time. Thank you very much for your support.

    Regards
Back to Top