Difference between Datagrid, Datalist and repeater in ASP.NET

Difference between Datagrid, Datalist and repeater.

Similarities:

They are all ASP.NET data Web controls.

They have common properties like

- DataSource Property
- DataBind Method
- ItemDataBound
- ItemCreated

When the DataSource Property of a Datagrid is assigned to a DataSet then each DataRow present in the DataRow Collection of DataTable is assigned to a corresponding DataGridItem.

Difference:

Datagrid
The HTML code generated has an HTML TABLE element created for the particular DataRow and is a tabular representation with Columns and Rows. Datagrid has a in-built support for Sort, Filter and paging the Data.

Datalist
An Array of Rows and based on the Template Selected and the RepeatColumn Property value The number DataSource records that appear per HTML

Repeater Control
The Datarecords to be displayed depend upon the Templates specified and the only HTML generated accordingly. Repeater does not have in-built support for Sort, Filter and paging the Data.

Difference between Datagrid, Datalist and repeater.

Datagrid: For displaying data in an HTML <table>.i.e. DataGrid displays each DataSource record as a row in an HTML <table>, and each field as a column in said table. No matter what one record will occupy an entire row. However, it has max features, like paging and sorting which are much easier to implement in datagrid with minimal coding. DataList: Highly customized layout.You can display multiple records in a single row. has advanced features and is much more customizable than the datagrid. Is bidirectional. Repeater:it has only a subset of the DataList's template options. Provides the maximum amount of flexibility over the HTML produced. Repeater is a good choice if you need to display your data in a format different than an HTML <table>. It needs a lot of coding to add editing, sorting and paging features.
What are the events in GLOBAL.ASAX file?
ASP.NET What are the events in GLOBAL.ASAX file? - Global.asax file contains the following events:.....
What are different IIS isolation levels supported in ASP.NET?
What are different IIS isolation levels supported in ASP.NET? - In this main IIS process and ASP.NET application run in same process due to which if one crashes.....
ASP.NET Difference between Gridlayout and FlowLayout.
ASP.NET - Difference between Gridlayout and FlowLayout - GridLayout provides absolute positioning for controls placed on the page.....
Post your comment