ASP.NET Developer's JumpStart By Paul D. Sheriff, Ken Getz
Table of Contents
Chapter 18. Using the Repeater Control
The Repeater control is the simplest of the list-bound controls in that it doesn't do much. However, it can loop through a set of data, and it can display information from each row, without you writing much code or doing much work. Here are some key items you should take away from this chapter:
The Repeater control is one of three list-bound controls provided by ASP.NET: Repeater, DataList, and DataGrid. Each of the three list-bound controls provides different features, with different uses.
You must set the Repeater's DataSource property to bind it to any object that supports the IEnumerable interface. In this example, you bound the control to a DataTable object.
In order for the Repeater control to display its data, you must supply at least one HTML template: the ItemTemplate element. You can also supply HeaderTemplate, FooterTemplate, SeparatorTemplate, and AlternatingItemTemplate elements.
You must call the DataBind method of the Repeater control in order to load the data into the control.
You can react to the ItemCommand event in your code-behind file, which is raised when a user clicks a button or link within the Repeater control.
You can pass information from the Repeater to the event handler using the CommandArgument and CommandName attributes.