Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Datagrid vs Datalist vs Repeater

Datagrid vs Datalist vs Repeater

Scheduled Pinned Locked Moved ASP.NET
visual-studiocomquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jon G
    wrote on last edited by
    #1

    Can someone elaborate the major differences between these three controls (Datagrid/Datalist/Repeater) ???? Why would I use a Datagrid over the other 2? Why would I use a Datalist over the other 2? Why would I use a Repeater over the other 2? I've been reading on these controls, and they all seem to do the exact same thing. Please, can I get some insight on this matter? Thanks, Jon G www.Gizmocoder.com

    M 1 Reply Last reply
    0
    • J Jon G

      Can someone elaborate the major differences between these three controls (Datagrid/Datalist/Repeater) ???? Why would I use a Datagrid over the other 2? Why would I use a Datalist over the other 2? Why would I use a Repeater over the other 2? I've been reading on these controls, and they all seem to do the exact same thing. Please, can I get some insight on this matter? Thanks, Jon G www.Gizmocoder.com

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      Hi Jon. DataGrid, DataList, and Repeater are similar controls in that you can use them all to present data in a common way (by setting the DataSource property calling the DataBind() method). The Repeater control gives you the most flexibility in how the data is presented. You use templates - HeaderTemplate, ItemTemplate, FooterTemplate, and others - to layout how you want the data to look. I have used the Repeater to generate everything from an html <table>, to an html <ul> list, to a simple comma-separated text list in a single line. The DataList control specifically presents your data in an html <table>. It's simple to use, uses templates like the Repeater control to govern the layout of individual cells, and allows some degree of flexibility over the use of columns (with properties like RepeatCount and RepeatDirection). In a DataList table, rows and columns are for layout only; it's not the case that one row would correspond to one record of data, with columns representing fields. Rather, each cell represents one record of data, and the layout is horizontal or vertical depending on the properties. I've used the DataList when presenting a page of catalog images... each cell was one image with comments (one record of data) and I laid them across three columns of the table. The DataGrid control also presents data as an html <table>, but in this case each row is intended to represent one record of data, with columns representing (typically) individual fields. The DataGrid provides some built-in support for inline editing, paging, sorting... it is the most complicated of the three to use, but learning its intricacies has paid off for me in creating UI's for data-editing/reporting applications. Check out Marcie's site http://www.datagridgirl.com[^] for a bunch more on the DataGrid. I hope this helps.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups