Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Repeater, ListView, DataList, DataGrid, GridView ... Which to choose?

So many different controls to choose from! What are best practices for determining which control to use for displaying data in ASP.NET?

like image 854
mattruma Avatar asked Sep 26 '08 12:09

mattruma


People also ask

Is GridView or Repeater better?

A GridView control is used when you want to display a set of data in a table format. A Repeater is when you want to display data repeatedly, but not necessarily in a tabular format. If you want a table, use a GridView, otherwise use a Repeater. The speed of loading/updating is negligible between the two.

What is the difference between ListView & repeaters?

Between the two, ListView gives you a lot more events and built-in commands for editing, selecting, inserting. Additionally paging and grouping functionality. A Repeater is extremely simple, it repeats a layout with the data. Since you're building the layout by hand, Listview and Repeater require more code.

What are the advantages of DataList control over DataGrid and Repeater control?

DataList has more features but more limited in design when compared to Repeater. In the other hand, it has more flexibility and less features than GridView. Also, DataList has RepeatDirection, RepeatColumns and RepeatLayout properties, which are unique for DataList control.

Why Repeater is faster than GridView?

Repeater is faster because it offers only basic data bound control rendering functionalities. If you want to show data and you don't need any complex features described below then repeater is the right joice.


1 Answers

It's really about what you trying to achieve

  • Gridview - Limited in design, works like an html table. More in built functionality like edit/update, page, sort. Lots of overhead.

  • DataGrid - Old version of the Gridview. A gridview is a super datagrid.

  • Datalist - more customisable version of the Gridview. Also has some overhead. More manual work as you have to design it yourself.

  • ListView - the new Datalist :). Almost a hybrid of the datalist and gridview where you can use paging and build in Gridview like functionality, but have the freedom of design. One of the new controls in this family

  • Repeater - Very light weight. No built in functionality like Headers, Footers. Has the least overhead.

like image 90
WebDude Avatar answered Sep 19 '22 08:09

WebDude