ASP.NET Repeater ItemDataBound happening AFTER PreRender event

asp.netdata-bindingeventspage-lifecyclerepeater

I have a repeater control on an ASP.NET 2.0 web form.

As I understanding it, all of the page's data-bound controls fire their binding events somewhere in between the Page_Load and the Page_PreRender events.

However, my repeater's ItemDataBound event appears to be happening AFTER the PreRender event.

How is this so and is there any way I can access the page controls AFTER all the ItemDataBound events have fired?

Updates:

  • The Repeater uses an ObjectDataSource with the DataSourceID declarative set in the repeater control.

  • The DataSource ID or object is not modified at all during the page life-cycle.

Best Answer

Declarative databinding (datasource specified via the DataSourceID property) occurs later than the PreRender event. The behavior you are observing is by design. If this is not what you need you should explicitly databind your control - just call its DataBind method.

Related Topic