|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
How to: Display Bound Data in a DataRepeater Control (Visual Studio)
Updated: July 2008
The most common use of the DataRepeater control is to display bound data from a database or other data source.
In addition to bound controls, you may want to add other controls, such as a static label or an image that is repeated on each item in the DataRepeater control. For more information, see How to: Display Unbound Data in a DataRepeater Control (Visual Studio).
Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.
To create a data-bound DataRepeater
Drag a DataRepeater control from the Visual Basic PowerPacks tab in the Toolbox to a form or container control.
Drag the sizing and position handles to size and position the control.
Note that the control has two rectangular regions. The upper region is the item template; controls added to the template will be repeated in each item in the DataRepeater control at run time. The lower region is the viewport, where the items will be displayed.
You can also size and position the control or the item template by changing the Size and Position properties in the Properties window.
On the Data menu, click Show Data Sources.
If the Data Sources window is empty, add a data source to it. For more information, see Data Sources Overview.
In the Data Sources window, select the top-level node for the table that contains the data that you want to bind.
Change the drop type of the table to Details by clicking Details in the drop-down list on the table node.
Select the table node and drag it onto the item template region of the DataRepeater control.
You can specify which types of controls are displayed for each field. For more information, see How to: Set the Control to be Created when Dragging from the Data Sources Window.