0
votes

I have never used any of the datasource objects in my aspx pages. I set the datasource for a gridview and databind() in the page's code behind. I am looking at some samples which use a sqldatasource and datasourceid in a gridview.

My question is when a sqldatasource is used as a data source for a gridview, does the databinding happen in page's init lifecycle? Is it the same as setting the datasource and databind in init event when not using a sqldatasource?

1
There's a DataBinding event in the life-cycle, so that's when it would get bound (so no, not the same). - McGarnagle

1 Answers

0
votes

1- yes , in Prerender event a method EnsureDataBound() is fired that calls gridview Databind() method

2- yes it is

you can check these posts :