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:
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?