DataBind not always after Page.PreRender...
So I just spent hours following Microsoft's Lifecycle Page, wondering why and how my GridView with a DataSourceId was binding AFTER the OnPreRender method on my Page.
It literally says (see those bold letters):
Before this event occurs:
The Page object calls EnsureChildControls for each control and for the page.
Each data bound control whose DataSourceID property is set calls its DataBind method. For more information, see Data Binding Events for Data-Bound Controls later in this topic.
The PreRender event occurs for each control on the page. Use the event to make final changes to the contents of the page or its controls.
And...It is wrong. Your controls may start DataBinding before PreRender, but they are not DataBound until after PreRender is called.
0 comments:
Post a Comment