Frage

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

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top