We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 6
Using the Repeater and DataList Controls
Developed By: Dhabaliya Nikita
Using the Repeater and DataList Controls 1. Using the Repeater Control 2. Using the DataList Control Using the Repeater and DataList Controls Using the Repeater Control The Repeater control provides you with the maximum amount of flexibility in rendering a set of database records. You can format the output of the Repeater control in any way that you please.
Displaying Data with the Repeater Control
To display data with the Repeater control, you must create an ItemTemplate. ShowRepeater.aspx Using Templates with the Repeater Control The Repeater control supports five different types of templates: (1) ItemTemplate Formats each item from the data source. (2) AlternatingItemTemplate Formats every other item from the data source. (3) SeparatorTemplate Formats between each item from the data source. (4) HeaderTemplate Formats before all items from the data source. (5) FooterTemplate Formats after all items from the data source. ShowSeparatorTemplate.aspx Using the Repeater and DataList Controls Using the DataList Control The DataList control, like the Repeater control, is template driven. Unlike the Repeater control, by default, the DataList renders an HTML table. Because the DataList uses a particular layout to render its content, you are provided with more formatting options when using the DataList control.
ShowFlowDataList.aspx
Displaying Data in Multiple Columns
You can render the contents of a DataList control into a multi-column table in which each data item occupies a separate table cell. Two properties modify the layout of the HTML table rendered by the DataList control: (1) RepeatColumns The number of columns to display. (2) RepeatDirection The direction to render the cells. Possible values are Horizontal and Vertical. MultiColumnDataList.aspx Using the Repeater and DataList Controls Using Templates with the DataList Control The DataList control supports all the same templates as the Repeater control: (1) ItemTemplate Formats each item from the data source. (2) AlternatingItemTemplate Formats every other item from the data source. (3) SeparatorTemplate Formats between each item from the data source. (4) HeaderTemplate Formats before all items from the data source. (5) FooterTemplate Formats after all items from the data source In addition, the DataList supports the following templates: (1) EditItemTemplate Displayed when a row is selected for editing. (2) SelectedItemTemplate Displayed when a row is selected.
ShowDataListTemplates.aspx Using the Repeater and DataList Controls