ASP.Net DataList Style Templates

Updated on 08 Aug 2012,
Published on 02 Apr 2009

In the previous tutorial we discussed about the templates of ASP.Net 2.0 DataList control. Templates support the HTML markup tags that enable you to define the structure and layout of data items that you retrieve from the data source bound to DataList control. There are some other types of templates available for DataList control that enable you to apply the style formatting of data list items. You can set the font styles, color, background color, and border styles etc using these style templates whereas DataList properties allow you to change the rendering style as well as common attributes to customize the layout of templates.

Each template of DataList control has its own style template that enables you to set the appearance of associated template only. For example, HeaderStyle template attributes set the styles for HeaderTemplate. Following are the style templates of DataList Control:

1. ItemStyle: This style template applies the styles to ItemTemplate.

2. AlternatingItemStyle: it applies the styles to AlternateItemTemplate. You can set alternate font color, background color for alternate data list items.

3. SeparatorStyle: you can apply the style formatting to separator between ItemTemplates and AlternateItemTemplate. SeparatorStyle set the styles for SeparatorTemplate that renders between each ItemTemplate and AlternateItemTemplate.

4. SelectedItemStyle: This style template changes the look of selected item. SelectedItemStyle works for SelectedItemTemplate. If SelectedItemTemplate does not exist inside the DataList control then it applies the styles to the ItemTemplate when “select” command action runs for any list item of DataList control.

5. EditItemStyle: it sets the styles for EditItemTemplate that renders when "edit" command action runs for any data list item.

6. HeaderStyle: You can set the styles for HeaderTemplate.

7. FooterStyle: Similar to HeaderStyle you can apply the styles to FooterTemplate of DataListControl.

Next we will learn about RepeatLayout, RepeatDirection and RepeatColumns property of ASP.Net 2.0 DataList Control. All these properties enable you to customize the layout rendering of DataList control.

Welite - Responsive Personal WordPress Blog Theme
0 Responses to "ASP.Net DataList Style Templates"
Leave a Comment
* required
* required
* will not be published
* optional
* hint:
  • Subscribe via Email