Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 918
Ash Machine Avatar asked Jan 20 '09 22:01

Ash Machine


2 Answers

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

like image 96
Dhaust Avatar answered Nov 16 '22 14:11

Dhaust


Are you feeding the refreshed data source?

If you are setting data source in code-behind, you need to set it with refreshed data then call DataBind method.

like image 1
Brian Kim Avatar answered Nov 16 '22 13:11

Brian Kim