DataList Control
DataList Control of ASP.Net 2.0 provides the functionality to display the data in form of ordered or unordered list of items. DataList control includes different types of templates that also enable you to select, edit, update or delete the data items. You can organize the data items bound to the DataList control using simple HTML markup tags inside the templates. ItemTemplate field is the most necessary element of the DataList control that enables you to display the retrieved data items from any datasource. There are style templates also that can be used to customize the appearance of list items of DataList. Following are the types of templates of ASP.Net 2.0 DataList control:
1. ItemTemplate: This is the main template that displays the data content retrieved from the datasource in the specified layout and CSS style applied to it. ItemTemplate is the required template of DataList control.
2. AlternatingItemTemplate: You can define the alternate style for the data content that is to be displayed inside the DataList. Alternate template renders the data items according to the specified layout and appearance styles associated to it. If AlternateTemplate is not defined then DataList control renders the ItemTemplate only.
3. SeparatorTemplate: It allows you to separate the repeat layout of list items inside the DataList control. SeparatorTemplate renders the specified separator character, text or any HTML markup tag between items as well as alternating items.
4. SelectedItemTemplate: It displays the content with specified style and layout applied to the selected item template. SelectedItemTemplate renders only when selected index changed event of DataList control fires.
5. EditItemTemplate: You can place the textbox controls inside this template for the data fields to allow the users to update the old value with new one. EditItemTemplate renders when DataList control receives the edit command event signal.
6. HeaderTemplate: You can display the heading at the top of list items by specifying customized appearance for the header text.
7. FooterTemplate: Similar to HeaderTemplate you can also add the footer text with customized appearance under the DataList control’s data items.