One of the issues that keeps on coming up when using <asp:UpdatePanel/> is that there is no way to get hold of the (non existant) client side OnUpdated and OnUpdating events. Most of the time there is no need to get hold of these events but every now and then we might want to do some action when the panel has updated (say navigate to #top).
I've built up a small control named UpdatePanelExtender and a JavaScript file that can be used to get hold of these client side events. Example usage might be:
1: <script type="text/javascript"> 1:
2: function updatedHandler(sender, e) { 3: alert('Panel updated:' + sender.get_element().id); 4: }
5:
6: function updatingHandler(sender, e) { 7: alert('Panel updating:' + sender.get_element().id); 8: }
</script>
2: <asp:UpdatePanel runat="server" ID="up">
3: <ContentTemplate>
4: ...
5: </ContentTemplate>
6: </asp:UpdatePanel>
7: <fa:UpdatePanelExtender OnUpdated="updatedHandler" OnUpdating="updatingHandler" TargetControlId="up" runat="server" />
The code and JavaScript has been attached to the post.
FuriousAngel.UI.Controls.UpdatePanelExtender.zip (2.32 kb)