Difference between DataGrid, DataLsit and Repeater?

 Posted by Syedshakeer on 2/14/2009 | Category: ASP.NET Interview questions | Views: 12952
Answer:

Difference between DataGrid, DataLsit and Repeater?

DataGrid:

1) DataGird has a in-built Support for Sort, Filter, and Paging the Data.

2) Each Row in DataGrid is displayed as a row in the table.

3) It has an AutoGenarateColumn Property, which can be set to either True or False.
Default property is true.

4) DataGrid has predefined Editing Controls.

5)Following are the DataGrid Data Control Styles:

i. AlternatingItemStyle
ii. EditItemStyle
iii. FooterStyle
iv. HeaderStyle
v. ItemStyle
vi. SelectedItemStyle
vii. PagerStyle

6) Following are the DataGrid Data Control Templates(only supported by the TemplateColumna) :

i. HeaderTemplate
ii. ItemTemplate
iii. EditItemTemplate
iv. FooterTemplate



DataList:

1) Support Paging, Sorting and editing but explicitly code to do Paging.

2) It displays the Records in Tabular form.

3) By default the DataList Displays its Data in a HTML .

4) You can specify via the repeat columns how many DataSource records should appear HTML .

Eg :

5)DataList Doesnot have Predefined Editing Controls.


6) Following are the Data Grid Data Control Styles:

i. AlternatingItemStyle
ii. EditItemStyle
iii. FooterStyle
iv. HeaderStyle
v. ItemStyle
vi. SelectedItemStyle
vii. SeparatorStyle

7) Following are DataList Data Control Templates:

i. AleternatingItemTemplate
ii. EditItemTempalte
iii. HeaderTemplate
iv. ItemTempalte
v. SelectedItemTemplate
vi. SeparatorTemplate
vii. SelectedItemTemplate
viii. FooterTemplate

Repeater:

1) It can be used for lightweight and simple report generation.

2) It is used to display a Repeated List of items that are bound to the control.

3) It does not support Paging.

4) Repeater is faster followed by DataList and finally DataGrid.

5) To create a table in a Repeater you must include the begin table tag in the HeaderTemplate,a single table row tag in the ItemTemplate and the end table tag
in the FooterTemplate

6)No predefined Styles

7) Following are Repeater Data Control Templates:

i. FooterTemplate


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Posted by: Sagnalrac on: 9/9/2015 | Points: 10
Although Repeater control does not support paging natively, actually, it IS possible to implement paging in it.

For more information: http://stackoverflow.com/questions/22904666/using-pagination-with-repeater-control-in-asp-net-web-form

Login to post response