Sameer Ahmed S
Sameer Ahmed S

Reputation: 1683

Why not we use Repeater Control instead of Gridview Control?

I know GridView control comes with lot of built in functionality, which we can achieve from repeater control. GridView control has performance issues. Why don't we use repeater?

You will be thinking why this question, if you can achieve the functionality and performance using repeater use it, but I want to understand why and when we should use repeater and GridView. Can anybody explain me how and when?

Upvotes: 1

Views: 4301

Answers (3)

mbillard
mbillard

Reputation: 38842

The GridView is for tabular data only and does a lot of the work for you, like binding data automatically to columns.

The Repeater gives you more control over the result, but you have to do more because nothing gets binded automatically.

I prefer using a Repeater almost every time, but I can see the usefulness of the GridView.

Upvotes: 1

keyboardP
keyboardP

Reputation: 69372

Like you said, the Repeater can perform certain aspects of the GridView. In this case, you'd want to use a Repeater. However, there are differences between the controls which cannot easily be substituted (or, necessarily, worth the time to implement). You can see a table of differences here. Knowing these differences can make it easier to decide what control to use depending on your needs. (From Link)

The GridView : it supports paging but it doesn't provide a flexible layout , since its mainly used to display the data in a table based layout.And If we looked at data inserting , the Gridview doesn't have a built in support for inserting data( since it doesn't call the insert method of it underlying data source when you click on a button with a CommadName set to "Insert" ).

The Repeater control : you will find that it provides a flexible layout but it doesn't support data grouping ,inserting,deleting , updating and paging through the data .

Upvotes: 1

Andrew
Andrew

Reputation: 5277

GridView supports a tablular style of layout. So works nicely for displaying data that would fit into a table. e.g. report style data

Repeater control is good for a more free style layout. Say for displaying products on an ecommerce website or for displaying entries on a forum or blog.

Upvotes: 1

Related Questions