This is a migrated thread and some comments may be shown as answers.

Any advice to retrieve selected date on client-side

2 Answers 260 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Utku Ozan
Top achievements
Rank 1
Utku Ozan asked on 03 Mar 2010, 12:15 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 03 Mar 2010, 12:49 PM
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.
0
Utku Ozan
Top achievements
Rank 1
answered on 03 Mar 2010, 01:13 PM
That has been great help in absolutely no time. Thank you very much for your support.

Regards
Tags
Calendar
Asked by
Utku Ozan
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Utku Ozan
Top achievements
Rank 1
Share this question
or