문제

I'm relatively new to ASP.net and while learning it I came across different ways people use to bind data to GridView:

  1. SqlDataSource
  2. ObjectDataSource
  3. Binding DataTable to GridView control from the code behind.

Which way is preferred and in what situations?

Thank you

도움이 되었습니까?

해결책

It depends on requirement. But ObjectDataSource and Binding DataTable to GridView control from the code behind are better then SqlDataSource. when you use linq or MVC then Prefer ObjectDataSource and for multi-tier architecture ASP.NET prefer Binding DataTable to GridView control from the code behind, I hope you will get the answer.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top