Updating Bound Controls in an UpdatePanel

Do you need to update a bound control like a GridView or Repeater that is contained in an AJAX UpdatePanel after data is updated? Well there is a trick to it that you need to remember. You would think this should work:

Code:

//Update some data           
missingVideosUpdatePanel.Update();

Shouldn’t calling the UpdatePanel.Update() cause the control to reload it’s data? Well it doesn’t. To properly reload the data you need to do this:

Code:

//Update some data           
missingVideosRepeater.DataBind();

Discover more from dotNetTips.com

Subscribe to get the latest posts sent to your email.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.