Chitika

Friday, November 16, 2012

Data controls in asp.net


In asp.net we have 4 major  data controls those are
  1. Repeater
  2. ListView
  3. DataList and
  4. GridView

Repeater: 

          Repeater usually works faster because of DataReader class, which is used for read only access. DataReader is faster than DataSet or DataTable classes commonly used with GridView. It doesn't provide paging and sorting of records.

ListView:

           ListView control is newest data presentation control, introduced in ASP.NET 3.5. 
           Now, there is new ListView control which tries to provide best from both sides: speed and flexibility in design, and also a lot of features like paging, updating or deleting of records etc.

DataList:

           DataList has RepeatDirection, RepeatColumns and RepeatLayout properties, which are unique for DataList control. These properties are useful when you need to create presentation with more than one record per row.

GridView:

          GridView displays data in form of grid. Rows and columns are represented as HTML table. This is very useful if you need grid-like presentation. If you need to present data in table layout, then GridView requires a minimum of effort. In same time, if you want more customizable flow layout, GridView is not best option. Common problem when using GridView control could be large ViewState which makes page loads slower and requires more bandwidth. 

Conclusion: When we consider performance the order of these controls would be Repeater, ListView, DataList, and GridView.

No comments:

Post a Comment