If I have a control on a page that has its Datasource set to a DataReader, does that control consume the reader at the time the Datasource is set, or does the datareader continue to exist until Databind has been executed?
What actually happens under the covers when Databind is executed?
Depending on the Control, DataBind() will Bind the Data to the Control. It does this by Iterating through the DataSource and create the Html and other Controls that are needed.
For a DropDownList, DataBind() will create the ListItem for each record in a DataSet or each Element in an ArrayList.
Later the Render method is call on the DropDownList, which returns the Html for a Select tag. It also creates the Html for each ListItem by returning Option tags inside the Select tag.
For a Label, DataBind() will set the Text to the value you pulled from the Database (for example).
If you don’t call DataBind() for the specific control, you can also make sure that your DataSource is set for a control and call Page.DataBind(). This will go through the Controls in the Page and call all of the DataBinds for each Control.