The WebRepeater class provides a template driven repeatable display bound to a datasource. The repeater supports Cursors, Object Arrays and Object Collections for databinding.
Repeaters work by using templates for displaying content. It has an ItemTemplate, Alternating Item template footer and header templates which can in turn contain other controls, expressions and literal text.
<ww:wwWebRepeater runat="server" id="repItems"
ItemChanged="repItems_ItemChanged" DataSource="tt_cust">
<HeaderTemplate>
<h1>Customer List</h1>
</HeaderTemplate>
<ItemTemplate>
Company: <ww:wwWebLabel runat="server" Text="hello" ControlSource="tt_cust.company"></ww:wwWebLabel>
Name: <%= tt_cust.Careof %>
<hr>
</ItemTemplate>
<FooterTemplate>
<small>generated at: <%= DateTime() %></small>
</FooterTemplate>
</ww:wwWebRepeater>
Note:
In order for the ControlSource binding to work you have to call DataBind() on the repeater either explicitly or through the Page's DataBind() method. <%= Expression %> binding always works regardless of whether DataBind() was called or not.
wwWebControl
wwWebRepeater
Remarks
Any child controls that are rendered inside of a repeater only call OnInit() for performance reasons. This means that some controls may not work as expected. The reason is performance and also the fact that repeater renders data items as part of the .Render() process of the page and doesn't run through the full page cycle of events.
Class Members
Member | Description | |
---|---|---|
ItemChanged |
Event that fires just after a new item has been loaded. You can hook this event to affect processing that occurs just before the data item is rendered. | |
ItemDataBind |
Event that is fired when an each item is databound in the ItemTemplate. | |
ItemPreRender |
Called just before a data item is rendered. This event occurs after control state - if any - has been restored | |
ActiveItemTemplate |
The currently active Item template instance while iterating over items. You can use this object in ItemDataBind() to grab the current template object if necessary. | |
DataBindItemTemplate |
Determines whether child controls are databound in item templates. Set to false to improve performance when you don't have Web Controls that require DataBind() to fire inside of a template and want to improve rendering speed. | |
DataSource |
The DataSource that is bound to this control. Can be a Cursor, Array of objects or a collection of Objects. | |
DataSourceType |
1 - Cursor/Table 2 - One Dimensional Object Array 3 - Collection of Objects |
|
IsAlternatingItem |
Flag that determines if during rendering an alternating item is active. | |
MaxItems |
Maximum number of items to display in this list. 0 means display all. | |
NoDataHtml |
Text string/html to display if there's no data to display, ie. the datasource contains no data. |
© West Wind Technologies, 1996-2024 • Updated: 01/07/12
Comment or report problem with topic