| Join | Help
in

Strong Coders Community

Where the extreme coders hang out.

GridView, Repeater, and DataList

Last post 01-11-2007 9:44 PM by manishbafna . 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 01-09-2007 7:37 AM
    • aspnetnewbie
    • Top 25 Contributor
    • Joined on 01-09-2007
    • Posts 4
    • Points 110

    GridView, Repeater, and DataList

    Reply Contact

    What's the difference between the GridView, Repeater and DataList? I'm confused as to when I should use one over the other.

    • Post Points: 50
  • 01-09-2007 8:24 AM In reply to
    • Dean Fiala
    • Top 10 Contributor
    • Joined on 10-17-2006
    • Posts 64
    • Points 830
    • MicrosoftMVP
      Moderator
      StrongCoders

    Re: GridView, Repeater, and DataList

    Answer
    Reply Contact

    When to use them depends on what you are trying to accomplish, and is usually driven by user and interface requirements.

    GridView - When you need a grid, with sorting, paging and inline editing capabilities.  These are already built in.

    DataList -  Based on the same underlying class as the GridView, it offers more control over the templates that comprise the control.  If the GridView is too heavy or you need some sort of funky display that you can't force the GridView to do.

    Repeater - When you need total control of how to render repeated data.  The repeater is lighter than the grid and also lets your repeat data horizontally if you desire.  A page displaying thumbnails would be one use of the repeater.

    Check out http://www.asp.net/learn/dataaccess/tutorial29vb.aspx?tabid=63 for a tutorial on the Repeater and DataList.
     

    Dean Fiala
    Very Practical Software, Inc.
    • Post Points: 5
  • 01-09-2007 12:38 PM In reply to
    • doug.nelson
    • Top 10 Contributor
    • Joined on 08-10-2006
    • Posts 23
    • Points 300
    • ASPInsiders

    Re: GridView, Repeater, and DataList

    Answer
    Reply Contact

    This is one of my favorite interview questions to ask when interview candidates.

    I my mind, a strong asp.net developer understands the differences between these controls and when that are appropriate to be used.

    Repeater - Think of what you did with classic asp and rolling through datasets, you essentially were doing the work of the repeater.  Based the concepts of templates, you layout how you want the html rendered for each row of data ( or data object).  The repeater does not add any additional html markup behind the scenes.

     Datalist - similar to the repeater with the exception of the data is rendered in either a html table or a collection of spans depending upon how the flow property is set.  The datalist is unique in that it also allows for repeating sections to be either horizontal or vertical and how many times to repeat the flow in that direction.  Think of the classic mailing label report and that will give you clean picture as to what I am refering.

    Datagrid - tabluar representation of data with built in support for inplace editing.  While the data list and the repeaters are template based, the datagrid in addition to being template based does so via a columns collection and it can be hooked up to datasource without any additional programming and it will present the data.  Columns can be datafields or templates.

     Hope this helps,

     

    • Post Points: 20
  • 01-11-2007 7:34 AM In reply to
    • aspnetnewbie
    • Top 25 Contributor
    • Joined on 01-09-2007
    • Posts 4
    • Points 110

    Re: GridView, Repeater, and DataList

    Reply Contact
    Thanks. That makes it much more clearer now.
    • Post Points: 5
  • 01-11-2007 9:44 PM In reply to
    • manishbafna
    • Top 10 Contributor
      Male
    • Joined on 10-18-2006
    • India
    • Posts 60
    • Points 1,000

    Re: GridView, Repeater, and DataList

    Reply Contact

    Hi,

    I may be going off the topic but you will this info also useful.Datagridview control are known to generate huge viewstate.But if we disable viewstate for datagridview then its advanced functionality like paging/sorting are lost.Find below a url where it shows how to disable viewstate for datagrid and still have advanced features like sorting/paging.It will reduce viewstate by more than 90%.

    http://www.codeproject.com/aspnet/DataGridViewState.asp

    I have already posted this link previously also but for your info i am posting it again.

    Thanks and Regards,

    Manish Bafna.

    MCP and MCTS.

    • Post Points: 5
Page 1 of 1 (5 items)

Copyright © 2006-2007 Strong Coders Community. All rights reserved.
Privacy Statement | Terms Of Use | Advertise with us | Site Feedback

Powered by Community Server (Commercial Edition), by Telligent Systems