Pregunta

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

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top