I have RadDatePicker in detail window for grid. I need to modify background color dynamically so I added new script to Calender like this:
It looks that table element with id "<ctrl_name>_calendar" is always there and never unloaded.
Can you help me how to dispose this object or remove event from it?
Thank you.
datePicker.Calendar.ClientEvents.OnLoad = initMethodName;Now I noticed that calendar is never destroyed from page. If I close detail window and open it again then initialization method is called twice.
It looks that table element with id "<ctrl_name>_calendar" is always there and never unloaded.
Can you help me how to dispose this object or remove event from it?
Thank you.
Hi Petr,
You can use the remove_load method to detach the OnLoad event:
<script> function initMethodName(sender, args) { sender.remove_load(initMethodName); } window.onbeforeunload = function () { detachCalendarEvents(); }; function detachCalendarEvents() { var datePicker = $find("<%= RadDatePicker1.ClientID %>"); // Adjust the ID accordingly if (datePicker && datePicker.get_calendar()) { datePicker.get_calendar().remove_load(initMethodName); // Assuming remove_load is a valid method } } </script>
It works!
Thanks for your help.