如何动态刷新的.NET数据绑定Repeater控件绑定、控件、动态、数据

2023-09-04 09:36:35 作者:温柔体贴i

我有一个 .NET转发控件是数据绑定到列表中。由于直放站的项目集合的一部分,我有一个删除按钮,有效地消除这个当前列表元素。

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.

这工作,在code-的背后,我能成功地从数据源的删除一个项目的转发的。

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

我的问题是这样的::当我重新更新数据源并调用 MyRepeater.DataBind()再次,在转发的接口不与该项目刷新删除。

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.

推荐答案

您需要调用'的DataBind'的方法在你的数据源,然后的叫'的DataBind'您的Repeater控件。

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