Which control has a faster performance, Repeater or Datalist?


What is a bubbled event in ASP.NET server side controls?

Bubbling an Event
The ASP.NET page framework provides a technique called event bubbling that allows a child control to propagate events up its containment hierarchy. Event bubbling enables events to be raised from a more convenient location in the controls hierarchy and allows event handlers to be attached to the original control as well as to the control that exposes the bubbled event.
Event bubbling is used by the data-bound controls (Repeater, DataList, and DataGrid) to expose command events raised by child controls (within item templates) as top-level events. While ASP.NET server controls in the .NET Framework use event bubbling for command events (events whose event data class derives from CommandEventArgs), any event defined on a server control can be bubbled.

Difference between datagrid and repeater?

Repeator Control:
1)Read-only; no inherent support for selection or editing ·
2)No inherent look; you lay out the list by creating templates.
3)List can be vertical, horizontal, all on one line, or in any format you specify. ·
4)No default paging; all data is displayed in a single list. ·
5)Separators between elements can be defined using a template

1)Default look is a grid (customizable table) ·
2)Can customize look of table extensively. ·
3)Options for auto-formatting. ·
4)Can specify output using bound columns, columns of buttons or hyperlinks, and custom
columns created using templates. ·
5)No separator template. However, the grid renders in a table, and you can specify table border size and color. ·
6)WYSIWYG template editing ·
7)Items support styles for custom look. ·
8)Editable contents, including deletion ·
9)Single and multiple selection ·
10)Optional paged output ·Support for sorting ·
11)Support for custom functionality that can be applied to items

What is the difference between Datagrid, Datalist and repeater?

A Datagrid, Datalist and Repeater are all ASP.NET data Web controls.

They have many things in common like DataSource Property, DataBind Method ItemDataBound and ItemCreated.

When you assign the DataSource Property of a Datagrid to a DataSet then each DataRow present in the DataRow Collection of DataTable is assigned to a corresponding DataGridItem and this is same for the rest of the two controls also. But The HTML code generated for a Datagrid has an HTML TABLE <ROW> element created for the particular DataRow and its a Table form representation with Columns and Rows.

For a Datalist it””s an Array of Rows and based on the Template Selected and the RepeatColumn Property value We can specify how many DataSource records should appear per HTML <table> row. In hort in datagrid we have one record per row, but in datalist we can have five or six rows per row.

For a Repeater Control, the Datarecords to be displayed depends upon the Templates specified and the only HTML generated is the due to the Templates.

In addition to these, Datagrid has a in-built support for Sort, Filter and paging the Data, which is not possible when using a DataList and for a Repeater Control we would require to write an explicit code to do paging.

What is the difference between Datalist and Repeater?

  • Datalist supports multiple columns displaying and using repeat columns property
  • Repeater doesn’t support multiple columns display,no repeat columns property
  • Datalist supports styles for formating templates data[headerstyle,…]
  • Repeater is not providing styles
  • Datalist renndering output[html content]will be slow compare with repeater.

If the requirement can achieve using repeater and datalist,choose repeater for better performance.

How to handle EmptyDataTemplate with repeater ?

Unlike gridview, you can’t find <EmptyDataTemplate> with repeater. You need to handle such situation some different way. One of the way to handle this is, to keep label(initially hidden) in the footer template of repeater. With ItemDataBound event, you can get item count of the repeater and from that count you can decide visibility of the label in footer.