Wednesday, February 3, 2010

Difference between DataGrid and GridView?

 GridView Control has replaced the ASP.NET 1.1 DataGrid Control.

The GridView and the DataGrid controls have a different foundation. To enable easy migration from existing pages, the GridView preserves the DataGrid object model as much as possible. However, we shouldn’t expect 100 percent compatibility between DataGrid-based code and new GridView-based code.

Another key difference between the DataGrid and GridView controls lies in the adaptive user interface.  Unlike the version 1.x DataGrid, the GridView can render on mobile devices, too. In other words, to build reports on mobile devices, we can use the same grid control we would use for desktop pages. The DataGrid version 2.0 can also render adaptively, but its UI capabilities are not quite as rich as those of the GridView.

In ASP.NET 2.0, the DataGrid control has been enhanced to support common control feature such as themes and personalization. In addition, the new DataGrid control can be populated by a data source control. Remember, though, that a DataGrid can only bind to a data source object for the purpose of reading data. To actually modify the underlying data source, some user-defined code is still required. In contrast, the GridView control takes advantage of the capabilities of the underlying data source and automatically deletes or updates records. Note that the GridView control also supports the classic binding mechanism based on the DataSource property and the DataBind method.

No comments:

Post a Comment