I think when you say
"we can use choose datasource option directly and select the datasource. " you mean, you can do it in design view or directly in .aspx page.
When you work with the design view, you have very limited ability to play with (manipulate) the data source. In this case you might not be following the any architecture (like 3 tier). You will have to depend on another ASP.NET Server control like SqlDataSource control or XmlDataSource control.
When you set the DataTable or DataSet as data source in the code behind file, you have complete control over it. You might be writing the data access code in another layer and calling that method in UI layer (read 3-tier architecture implementation and benefit -
http://www.dotnetfunda.com/articles/show/2708/3-tier-architecture-in-aspnet-a-complete-article) .
However, you have a asp:ObjectDataSource where you can use methods of code behind to populate the data into GridView, however that is not easy and straight forward as setting the data source directly from the code behind.
So you can say, it's matter of preference and how comfortable you feel. I personally, do not use .aspx / or design view to set the data source. Particularly for GridView as it is data intensive control.
Hope this answer your question.
Thanks
Regards,
Sheo Narayan
http://www.dotnetfunda.com
Rasagna, if this helps please login to Mark As Answer. | Alert Moderator