Monday, June 13, 2011

Differences between Datagrid, Datalist and Repeater?

Differences between Datagrid, Datalist and Repeater


  • Datagrid has paging while Datalist and Repeater don’t. Datalist and Repeater have
    a property called repeat. Direction = vertical/horizontal. (This is of great help
    in designing layouts). This is not there in Datagrid.
  • A repeater is used when more intimate control over html generation is required.
  • A repeater has the best performance as its lighter. DataLists and DataGrids have
    inbuilt methods which makes them heavier in load, but also very effective if you
    need to display data in a number of ways (i.e. sorting, indexing, records per page
    etc.) whereas with a Repeater you'd have to implement these yourself.
  • If you simply want to output some data on a page I'd recommend a Repeater. If however
    you'll be manipulating this data in any way, such as sorting etc. Then use a DataList
    or DataGrid. The choice should depend upon the data you have and what you want to
    do with it.
Also as mentioned above it's much easier to implement custom html into a Repeater.
You can still however do this with a DataGrid or DataList. it's just a little trickier.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.