Refresh UpdatePanel via JavaScript

I have seen this asked a couple of times in the newsgroups hence this post. A simple way of refreshing an UpdatePanel using JavaScript is to add a HiddenField to the page, change its value using JS and then have the HiddenField raise a postback event.

The HiddenField causes the UpdatePanel to refresh because it has been declared as a trigger, is a child trigger or because the UpdatePanel.Update() method is called in the HiddenField ValueChanged event handler. The sample code (mirror) shows these three scenarios.

Note: The HiddenField will obviously need to be registered as an async postback control (RegisterAsyncPostBackControl) if it is outside the UpdatePanel.

15 Comments

Comments have been disabled for this content.