You must Sign In to post a response.
  • Category: ASP.NET

    Different between repeater control & data grid view

    different between repeater control & data grid view control with example in briefly
  • #648091
    THE MAIN DIFFERENCE IS WE CANNOT NOT CHANGE THE LAYOUT IN GRIDVIEW BUT IN Repeater CONTROL

    SECOND
    IN GRIDVIEW CONTROL AS DEFAULT IT HAS PAGING OPTION

    Features of a GridView
    •Displays data as a table
    •Control over
    –Alternate item
    –Header
    –Footer
    –Colors, font, borders, etc.
    –Paging
    •Updateable
    •Item as row

    Features of Repeater

    •No default output
    •More control
    •More complexity
    •Item as row
    •Not updateable

    by
    sabarinathan.R
    Be in first....
    but don't feel for being last

  • #648102
    Hi,

    Check out these articles, this clearly explains about the difference between
    these controls.

    http://aspnet.4guysfromrolla.com/articles/052103-1.aspx
    http://msdn.microsoft.com/msdnmag/is...p/default.aspx

    Regards
    Mr.Rajesh
    Software Engg.

  • #648105
    Hi,

    Repeater :

    It contains Header Template, Item template , alternate
    Item template and footer template . it can't support
    Selection, editing, sorting and paging. this is read only
    and fast.

    example:



    <%@ Import Namespace="System.Data" %>

    <script runat="server">
    sub Page_Load
    if Not Page.IsPostBack then
    dim mycdcatalog=New DataSet
    mycdcatalog.ReadXml(MapPath("cdcatalog.xml"))
    cdcatalog.DataSource=mycdcatalog
    cdcatalog.DataBind()
    end if
    end sub
    </script>

    <html>
    <body>

    <form runat="server">
    <asp:Repeater id="cdcatalog" runat="server">

    <HeaderTemplate>
    <table border="1" width="100%">
    <tr>
    <th>Title</th>
    <th>Artist</th>
    <th>Company</th>
    <th>Price</th>
    </tr>
    </HeaderTemplate>

    <ItemTemplate>
    <tr>
    <td><%#Container.DataItem("title")%> </td>
    <td><%#Container.DataItem("artist")%> </td>
    <td><%#Container.DataItem("company")%> </td>
    <td><%#Container.DataItem("price")%> </td>
    </tr>
    </ItemTemplate>

    <FooterTemplate>
    </table>
    </FooterTemplate>

    </asp:Repeater>
    </form>

    </html>
    </body>





    DataGrid(or GridView) :

    It contains Header Template, Item template , alternate Item
    template , Edit itm template and footer template . it can
    support selection, editing , sorting and paging . Mostly
    every developer caught used this control .

    With Regards
    Kushal

  • #648112
    Hi Mahesh,


    With gridview we can have these:
    which displays data as a table, Items as row, we can give Header,Footer to data.
    We can format the data based on your condition Colors, font, borders, etc.
    We can go with Paging, filtering, sorting.
    Main difference is DataGrid control allows you to select, sort, and edit the items.

    With Repeater we can have these:
    List format, No default output,More complexity,Item as row.
    For repeater more control over html generation is required than gridview.


    Hope this will give some idea.

    Regards,
    SonyShiva
    Never lose hope..You never know what tomorrow will bring

  • #648308
    1) Repeater is template driven, where as DataList and GridView are rendered as Table.
    2) Repeater cannot automatically generates columns from the data source, where as DataList and GridView can.
    3) Repeater and DataList supports customizable row separator, where as GridView does not support this feature.
    4) Sorting and Paging is only allowed in GridView and not in Repeater and DataList.
    5) Selection of row is supported by DataList and GridView and not by Repeater.
    6) Editing of contents is supported by DataList and GridView and not by Repeater.
    7) We can arrange data items horizontally or verticlaly in DataList, where as this feature is not supported by Repeater and GridView.


    Thanks & Regards
    Paritosh Mohapatra
    Microsoft MVP (ASP.Net/IIS)
    DotNetSpider MVM

  • #648411
    Hai Mahesh,

    Both controls(repeater and GridView) are used to display the data.
    Repeater does not support Selection, Editing, Sorting and Paging of the data while the GridView supports all these.

    Repeater can display single record at a time while GridView can show many items.

    Repeater is used only to display the data not to modify as it is read only but using GridView we can edit, insert, Update and delete the data inside the GridView.

    Repeater is fast but GridView is slow.

    Hope it will give you enough idea about the differences.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com

  • #648492
    Hi!

    AdRotator

    The Repeater control allows you to create templates to define the layout of its content. The templates are:

    >>ItemTemplate — Use this template for elements that are rendered once per row of data.
    >>AlternatingItemTemplate — Use this template for elements that are rendered every other row of data. This allows you to alternate background colors, for example.
    >>HeaderTemplate — Use this template for elements that you want to render once before your ItemTemplate section.
    >>FooterTemplate — Use this template for elements that you want to render once after your ItemTemplate section.
    >>SeperatorTemplate — Use this template for elements to render between each row, such as line breaks.

    DataGrid

    DataGrid Web server control is a powerful tool for displaying information from a data source. It is easy to use; you can display editable data in a professional-looking grid by setting only a few properties. At the same time, the grid has a sophisticated object model that provides you with great flexibility in how you display the data.

    Regards
    Kamlesh

    Regards
    Kamlesh Mohanty


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.