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.
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.
Are you specifically binding your repeater (myRepeater.DataBind();) in your code behind file (for example inside the Page_Load() event)?
Have you checked out the ASP.NET events lifecycle? Sorry if you already know this, but just in case: http://msdn.microsoft.com/en-us/library/ms178472.aspx
Hope it helps.
Ricardo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With