I have a DNN module that I am working on which includes a complex form with rules about sections of the form that should be shown or hidden based on options the user selects. I am currently showing and hiding those sections using div tags and jQuery, and it all works perfectly. On the same form are a couple of controls that require a postback to the server (a pair of date pickers - when the user changes the date selection, the contents of a combo box change to reflect available options within that date range). I have partial rendering turned on for the module, and I really want to keep it that way because of the better user experience.
My problem is that as soon as the user makes a chage that triggers an asynchronous postback, any divs that were previously hidden become visible again. If I could trigger some script following the return of the asynchronous request it would be fine, as I could just reset all of the divs to the correct state. I can't seem to make that happen, though.
The suggestion I keep seeing on different blog entries is to do something like:
<script type="text/javascript">
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function EndRequestHandler(sender, args) {
// js code here; runs only on async postbacks
}
</script>
When I try that, however, the EndRequestHandler never seems to fire. Am I missing something? Any suggestions on how to handle this would be greatly appreciated.