.netdata-bindingrefreshrepeaterdatabound

How to dynamically refresh a .NET databound repeater control


I have a .NET repeater control that is data-bound to a List. As part of the Repeater's Item Collection, I have a "Remove Button" that effectively removes this current List element.

This works, in code-behind I can successfully remove an item from the datasource of the Repeater.

My problem is this : when I reset the updated datasource and call MyRepeater.DataBind() again, the Repeater interface does not refresh with the Item removed.

I am looking for the event to essentially redraw or refresh the Repeater based on the updated List. Thanks for any pointers or examples.


Solution

  • You need to call the 'DataBind' method on your datasource, then call 'DataBind' on your Repeater control.