سؤال

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