Search code examples
jqueryasp.netajaxrepeater

How to refresh Repeater control from client side


I have a repeater control in my page A which I am populating at the page load. Then I have a jquery popup which allows me to add data to database using AJAX calls. Once data is being added to database I am redirecting user to new page page B (done using jquery).

When I try to return back to page A from page B using browser back button I want my repeater-list to be refreshed with new data which is not happening as once data is entered in to DB I am redirecting the user to Page B.

How do I refresh my repeater list from client side or on page load of Page A once user comes back to it using Bak click of browser? Any help appreciated.


Solution

  • The easiest way is to move away from the Repeater and use a JavaScript UI equivalent, whether it is JQuery (preferable, since you are already using it) or one of the other libraries.

    You could set up the output of the repeater, label it properly with an id, and have the JavaScript library do the update, but you then have two different points of failure for the same container on the page. And, any changes to rendering have to be made in two places. If you are already building a JQuery retrieval to the client side, then make the initial rendering client side as well. It follows DRY (Don't Repeat Yourself) and keeps the entire UI simpler.