2.3. Enhancing the Output of a Tabular Display
You need to display data from a database in a way that lets you organize and enhance the output beyond the confines of the
GridView control’s default tabular display. Selecting and editing the data are unimportant as is navigating through the data.
Repeater control with templates and then bind the data to the control.
In the .aspx file, add a
Repeater control and the associated templates for displaying the data.
In the code-behind class for the page, use the .NET language of your choice to:
ConnectionString, DataSourceMode, ProviderName, and
SelectCommandproperties of the
Assign the data source to the
Repeatercontrol and bind it.
Figure 2-2. Using templates with Repeater control display output
When your primary aim is to organize and enhance the output beyond the confines of the
GridView control’s default tabular display, the
Repeater control is a good choice because, unlike a
GridView, it has associated templates that allow you to use almost any HTML to format the displayed data. It has the advantage of being relatively lightweight and easy to use. When ...