View Single Post
 
Old August 10th, 2009, 05:51 PM
carewithl carewithl is offline
Authorized User
 
Join Date: Jun 2009
Posts: 32
Thanks: 17
Thanked 0 Times in 0 Posts
Default Author claims ObjectDataSource is bound to data source before Page_Load and not after

Greetings

I’m learning Asp.Net in parallel with reading this book, so I apologize if I’m way off with my questions.


1) Anyways, on page 257 author says the following:

Quote:
User’s location is not retrieved directly from her profile in the precceding code because that would cause a read for each and every row. Instead user's country, state and city are read only once from the profille and saved in local variables. Page_Load cannot be used for this because automatic binding done by the ObjectDataSource hapens earlier, so we have to use the Page_Init event handler
As far as I know ObjectDataSource is bound to data source after Page_Load and not before?! Or am I missing something?



2) Why does author ( on page 256 ) call gvwArticles.DataBind inside dllArticlesPerPage_SelectedIndexChanged, dllCategories_SelectedIndexChanged and gvwArticles_RowCommand.

As far as I know, ObjectDataSource will automatically call gvwArticles.DataBind on each postback?! I checked this by deleting gvwArticles.DataBind inside those methods, and as far as I could tell, everything worked the same! Or am I again missing something?


cheers