I have created a custom server side WebControl. This control calls an initialization script that uses jQuery to hookup the events with calls to bind when the page is loaded.
This control is now being used inside an UpdatePanel and obviously the client side events no longer exist after the UpdatePanel does it's thing. So, I need to re-run my initialization script if the control has been re-rendered as part of a partial page refresh and I don't see a good way of doing this.
I am aware of the ScriptManager.IsInAsyncPostBack and UpdatePanel.IsInPartialRendering, but they don't seem to provide what I need. It seems to implement this correctly that I will have to check if ScriptManager.IsInAsyncPostBack==true, then search up the control tree for an UpdatePanel that has IsInPartialRendering==true. If I find such an UpdatePanel then I re-run my initialization script.
Sounds horrible. Am I missing something simple? I can't be the only one who lives this way.
Thanks for reading!