Building Interactive User Interfaces with Microsoft ASP.NET AJAX: Refreshing An UpdatePanel With Jav
The ASP.NET AJAX UpdatePanel provides a quick and easy way to implement a snappier, AJAX-based user interface in an ASP.NET WebForm. In a nutshell, UpdatePanels allow page
developers to refresh selected parts of the page (instead of refreshing the entire page). Typically, an UpdatePanel contains user interface elements that would normally trigger
a full page postback - controls like Buttons or DropDownLists that have their AutoPostBack property set to True. Such controls, when placed inside an UpdatePanel,
cause a partial page postback to occur. On a partial page postback only the contents of the UpdatePanel are refreshed, avoiding the "flash" of having the entire page reloaded.
(For a more in-depth look at the UpdatePanel control, refer back to the Using the UpdatePanel
installment in this article series.)
Triggering a partial page postback refreshes the contents within an UpdatePanel, but what if you want to refresh an UpdatePanel's contents via JavaScript? Ideally,
the UpdatePanel would have a client-side function named something like Refresh that could be called from script to perform a partial page postback and refresh
the UpdatePanel. Unfortunately, no such function exists. Instead, you have to write script that triggers a partial page postback for the UpdatePanel you want to refresh.
This article looks at how to accomplish this using just a single line of markup/script and includes a working demo you can download and try out for yourself.
Read on to learn more!
Read More >