Hi,
I am new to telerik controls and I have inherited a website that heavily relies on Telerik controls.
I have created 2 raddatepickers. One of them has a client event OnDateSelected that updates the 2nd datepicker with a calculated date based on the first one. This works fine until another control on the same page/panel causes a partial postback (using the RadAjaxManager). After the partial postback my client event can no longer access the raddatepicker client object.
I have set the client event to be reattached after the partial postback. I don't know if that is necessary. ( I assumed it was based on this page http://www.telerik.com/help/aspnet/toolbar/toolbar_clienteventsunattached.html). I know that the event is reattached b/c I have stepped into the code using Firebug. However, when the
Here is the code that I used:
Any help would be appreciated.
Oran
I am new to telerik controls and I have inherited a website that heavily relies on Telerik controls.
I have created 2 raddatepickers. One of them has a client event OnDateSelected that updates the 2nd datepicker with a calculated date based on the first one. This works fine until another control on the same page/panel causes a partial postback (using the RadAjaxManager). After the partial postback my client event can no longer access the raddatepicker client object.
I have set the client event to be reattached after the partial postback. I don't know if that is necessary. ( I assumed it was based on this page http://www.telerik.com/help/aspnet/toolbar/toolbar_clienteventsunattached.html). I know that the event is reattached b/c I have stepped into the code using Firebug. However, when the
set_selectedDate
function runs nothing happens to the 2nd datepicker.Here is the code that I used:
<
telerik:RadDatePicker
ID
=
"dateTetanusReceived"
runat
=
"server"
>
<
ClientEvents
OnDateSelected
=
"TetanusDateSelected"
></
ClientEvents
>
</
telerik:RadDatePicker
>
<
telerik:RadDatePicker
ID
=
"dateTetanus"
runat
=
"server"
>
</
telerik:RadDatePicker
>
var
_TetanusExpiryPicker = $find(
"<%= dateTetanus.ClientID %>"
);
var
_TetanusPicker = $find(
"<%= dateTetanusReceived.ClientID %>"
);
function
TetanusDateSelected(sender, e) {
SetSecondDatePicker(_TetanusExpiryPicker, 10, e);
}
function
SetSecondDatePicker(datePicker, yearsToAdd, e) {
var
expiryDate = e.get_newDate();
expiryDate.setFullYear(expiryDate.getFullYear() + yearsToAdd);
datePicker.set_selectedDate(expiryDate);
}
//Event gets called after a partial postback ends
function
OnResponseEndHandler(sender, arguments) {
_TetanusPicker.add_dateSelected(TetanusDateSelected);
}
Any help would be appreciated.
Oran