Repeater
You may find a time when you need to display multiple rows of data but do not want to use a GRID control. This is when you could use the Repeater control.
Steps to Create
Preparing your Data
You will first need to define a Dataset, if not already created, so the Repeater control will have field names to use. There are a few requirements in the definition of your returned data for it to work specifically with a Repeater control. The returned field names need to be prefixed with “RH_” (upper- or lower-case works). This allows the engine to know which template fields should be replaced with the returned dataset field value. We will go over this a bit later.
Creating the Repeater Control
Within your page, select “REPEATER” from the “controltype” dropdown and select "New”. A dialog box will appear with the following tabs. Enter in the following data on the appropriate tab:
· General tab – Name the repeater using a meaningful name and description.
· Data Binding tab – Select the appropriate Data Set and enter in all your HTML content or just enough to save. You can always come back to edit this.
· Layout tab – Select the desired Place Holder and Order value.
· Conditional tab – Not necessary to make any changes here unless you conditionally want to hide the control from view.
Select Submit to save your changes which causes the dialog box to close. If the box does not close after clicking Submit, you most likely skipped over one of the required fields. Double check that you have defined/selected the Object Name, Description, Place Holder and HTML Repeater fields.
Defining the “HTML Repeater” Field
Let’s say your Data Set returns the following fields for these individuals, “John Doe” and “Jane Doe”:
· RH_FirstName
· RH_LastName
So, we have 2 rows of data, with the first name in the RH_FirstName field and their last name in the RH_LastName field. You could have this definition for your HTML Repeater field:
<div><strong>RH_FirstName</strong> RH_LastName</div>
You might have noticed that when using these fields, you don’t use the “&” to insert the value into the HTML. You can see now why the returned fields are required to be prefixed with “RH_” to know which fields it should replace. Because you could have it defined like this:
<div><strong>FirstName: RH_FirstName</strong> LastName: RH_LastName</div>
The duplicated text has been emboldened to show the similarities to the field names. But the engine will know to leave the “FirstName” and “LastName” (without the prefixed “RH_”) alone and only replace the values using the prefix. We are working within HTML and sometimes the “&” could be used so it is not helpful when trying to locate the field data contained within if defined like &FirstName. However, the Repeater control can still use content from your page by using the “&” symbol. For instance, if you have a control named “StartDate”, you could use “&StartDate” within your HTML Repeater definition and it will replace that with the value from that control. Just be careful where the symbol “&” is placed, and verify afterwards that you have your desired output.
After execution, the repeater control output would look something like this:
FirstName: John LastName: Doe
FirstName: Jane LastName: Doe
I am sure your use of the Repeater control will contain more relevant information and styled better using CSS than this example. But this concludes this brief introduction to the Repeater control.