System.Web 1.0.5000.0 2.0.0.0 Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. System.Web.UI.Control System.Web.UI.INamingContainer System.Web.UI.PersistChildren(false) System.Web.UI.ParseChildren(true) System.ComponentModel.Designer("System.Web.UI.Design.WebControls.RepeaterDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner") System.ComponentModel.DefaultProperty("DataSource") System.ComponentModel.DefaultEvent("ItemCommand")

In this topic:

Introduction

Data Binding

Templates

Declarative Syntax

## Introduction

The control is a basic templated data-bound list. It has no built-in layout or styles, so you must explicitly declare all layout, formatting, and style tags within the control's templates.

The control allows you to split markup tags across the templates. To create a table using templates, include the begin table tag (<table>) in the , a single table row tag (<tr>) in the , and the end table tag (</table>) in the .

The control has no built-in selection capabilities or editing support. You can use the event to process control events that are raised from the templates to the control.

This control can be used to display user input, which might include malicious client script. Check any information that is sent from a client for executable script, SQL statements, or other code before displaying it in your application. ASP.NET provides an input request validation feature to block script and HTML in user input. Validation server controls are also provided to assess user input. For more information, see Validation Server Controls.

## Data Binding

The control provides two properties to support data binding. To bind data to any collection that implements the interface (such as a , a , or an array), or the interface, use the property to specify the data source. When you set the property, you must manually write the code to perform data binding. To automatically bind the control to a data source represented by a data source control, set the property to the of the data source control to use. When you set the property, the control automatically binds to the specified data source control on the first request. Therefore, you do not need to explicitly call the method unless you have changed data-related properties of the control.

A control binds its and to either the data model declared and referenced by its property or the data source control specified by its property. The , , and are not data-bound.

If the control's data source is set but no data is returned, the control renders the and with no items. If the data source is null, the is not rendered.

## Templates

At a minimum, every control must define an . However, other optional templates described in the following table can be used to customize the appearance of the list.

Template name

Description

Defines the content and layout of items within the list. This template is required.

If defined, determines the content and layout of alternating (zero-based odd-indexed) items. If not defined, is used.

If defined, is rendered between items (and alternating items). If not defined, a separator is not rendered.

If defined, determines the content and layout of the list header. If not defined, a header is not rendered.

If defined, determines the content and layout of the list footer. If not defined, a footer is not rendered.

## Declarative Syntax

`<asp:Repeater DataMember="string" DataSource="string" DataSourceID="string" EnableTheming="True|False" EnableViewState="True|False" ID="string" OnDataBinding="DataBinding event handler" OnDisposed="Disposed event handler" OnInit="Init event handler" OnItemCommand="ItemCommand event handler" OnItemCreated="ItemCreated event handler" OnItemDataBound="ItemDataBound event handler" OnLoad="Load event handler" OnPreRender="PreRender event handler" OnUnload="Unload event handler" runat="server" Visible="True|False" > <AlternatingItemTemplate> <!-- child controls --> </AlternatingItemTemplate> <FooterTemplate> <!-- child controls --> </FooterTemplate> <HeaderTemplate> <!-- child controls --> </HeaderTemplate> <ItemTemplate> <!-- child controls --> </ItemTemplate> <SeparatorTemplate> <!-- child controls --> </SeparatorTemplate> </asp:Repeater>`

A data-bound list control that allows custom layout by repeating a specified template for each item displayed in the list.

- Constructor
  To be added

  Initializes a new instance of the class.

  1.0.5000.0
  2.0.0.0
- Property
  System.Web.UI.ITemplate a

  Use this property to provide a different appearance for alternating items in the control from what is specified in the .

  This control can be used to display user input, which might include malicious client script. Check any information that is sent from a client for executable script, SQL statements, or other code before displaying it in your application. ASP.NET provides an input request validation feature to block script and HTML in user input. Validation server controls are also provided to assess user input. For more information, see Validation Server Controls.

  Gets or sets the object implementing that defines how alternating items in the control are displayed.

  1.0.5000.0
  2.0.0.0
  System.Web.UI.TemplateContainer(typeof(System.Web.UI.WebControls.RepeaterItem))
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.ComponentModel.DefaultValue(null)
  System.ComponentModel.Browsable(false)
- Property
  System.Web.UI.ControlCollection a

  Use the collection to manage the child controls of the control. It is commonly used to retrieve a child control from the collection. You can also add and remove child controls from the collection.

  To access a child control within a control, iterate through the control's collection to retrieve the for a given index. Then call the Repeater item's inherited method to retrieve a control with a particular ID.

  Gets a that contains the child controls of the control.

  1.0.5000.0
  2.0.0.0
- Method
  System.Void To be added To be added 1.0.5000.0 2.0.0.0
- Method
  System.Void `` To be added

  Creates a control hierarchy, with or without the specified data source.

  Indicates whether to use the specified data source. 1.0.5000.0 2.0.0.0
- Method
  2.0.0.0
  System.Web.UI.DataSourceSelectArguments

  The first call to the property calls the method to return the value.

  Returns the value.

  The value.

- Method
  System.Web.UI.WebControls.RepeaterItem `` `` To be added

  Creates a object with the specified item type and location within the control.

  The new object.

  The specified location within the control to place the created item. A that represents the specified type of the item to create. 1.0.5000.0 2.0.0.0
- Method
  System.Void

  Use the method to bind the data source specified by the property to the control. When you bind a data source to the control, the information in the data source is displayed in the control.

  The method is also commonly used to synchronize the data source and a data listing control after information in the data source is updated. This allows any changes in the data source to also be updated in a data listing control.

  If the data source for the control is specified by the property, you do not need to explicitly call the method. ASP.NET calls this method automatically to bind the specified data source control to the control.

  Binds the control and all its child controls to the specified data source.

  1.0.5000.0
  2.0.0.0
- Property
  System.String To be added: an object of type 'string'

  If the data source specified by the property contains multiple sources of data, use the property to specify the specific source to bind to the control. For example, if you have a with multiple tables, you must specify which table to bind to the control. After you have specified the data source, use the method to bind the data source to the control.

  The value of this property is stored in view state.

  Gets or sets the specific table in the to bind to the control.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DefaultValue("")
- Property
  System.Object To be added: an object of type 'object'

  Use this property to specify the source of data to populate the control. The can be any collection such as a for accessing databases, a , or an array, or an object. When you set the property you must manually write the code to bind to the data source.

  If the data source specified by the property contains multiple sources of data, use the property to specify the specific source to bind to the control. For example, if you have a with multiple tables, you must specify which table to bind to the control. After you have specified the data source, use the method to bind the data source to the control.

  Alternately, you can use the property to automatically bind to a data source represented by a data source control. When you set the property, the control automatically binds to the specified data source control. You do not need to write code that explicitly calls the method unless you dynamically change properties of the control.

  If values are specified for both the property and the property, ASP.NET is not able to resolve the data source and a is thrown.

  Gets or sets the data source that provides data for populating the list.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.DefaultValue(null)
  System.ComponentModel.Bindable(true)
- Property
  2.0.0.0
  System.Web.UI.IDReferenceProperty(typeof(System.Web.UI.DataSourceControl))
  System.ComponentModel.DefaultValue("")
  System.String To be added.

  Use the property to access the property of the data source control that the control should use to retrieve its data source. The data source control that is referenced by the property can be any control that implements the interface. The data source control must exist either in the same naming container as the control that references it or in a parent control of the control. When you specify a value for the property, the control binds to the specified data source control. You do not need to write code that explicitly calls the method.

  Alternatively, you can use the property to specify the source of values to bind to the control. The data source must be a collection that implements the interface (such as the or object) or the interface. When you set the property, you must write the code to perform the data binding.

  If values are specified for both the and properties, ASP.NET is not able to resolve the data source and an exception is thrown.

  The value of this property is stored in view state.

  Gets or sets the property of the data source control that the control should use to retrieve its data source.

- Property
  2.0.0.0
  System.ComponentModel.DefaultValue(false)
  System.ComponentModel.Browsable(true)
  System.Boolean To be added.

  The property indicates whether themes are enabled. When the property is true, the theme directory for the application is searched for control skins to apply. If no skin for the particular control exists in the theme directory, skins are not applied.

  Gets or sets a value indicating whether themes are applied to this control.

- Method
  2.0.0.0
  System.Void

  When you specify a value for the property, ASP.NET automatically binds the control to the specified data source control. When ASP.NET performs data binding for the control, it first calls the method to verify that the control has not already been data bound and that a valid data source control that implements the interface is specified for its property. The method then calls the method.

  Verifies that the control requires data binding and that a valid data source control is specified before calling the method.

- Property
  System.Web.UI.ITemplate a

  Use this property to create a template that controls how the footer section of a control is displayed.

  This control can be used to display user input, which might include malicious client script. Check any information that is sent from a client for executable script, SQL statements, or other code before displaying it in your application. ASP.NET provides an input request validation feature to block script and HTML in user input. Validation server controls are also provided to assess user input. For more information, see Validation Server Controls.

  Gets or sets the that defines how the footer section of the control is displayed.

  1.0.5000.0
  2.0.0.0
  System.Web.UI.TemplateContainer(typeof(System.Web.UI.WebControls.RepeaterItem))
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.ComponentModel.DefaultValue(null)
  System.ComponentModel.Browsable(false)
- Method
  2.0.0.0
  System.Collections.IEnumerable

  The data source is specified either by the property or by the and properties.

  Returns an interface from the data source.

  An object implementing that represents the data from the data source.

- Property
  System.Web.UI.ITemplate a

  Use this property to create a template that controls how the header section of a control is displayed.

  This control can be used to display user input, which might include malicious client script. Check any information that is sent from a client for executable script, SQL statements, or other code before displaying it in your application. ASP.NET provides an input request validation feature to block script and HTML in user input. Validation server controls are also provided to assess user input. For more information, see Validation Server Controls.

  Gets or sets the that defines how the header section of the control is displayed.

  1.0.5000.0
  2.0.0.0
  System.Web.UI.TemplateContainer(typeof(System.Web.UI.WebControls.RepeaterItem))
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.ComponentModel.DefaultValue(null)
  System.ComponentModel.Browsable(false)
- Property
  2.0.0.0
  System.Boolean To be added.

  The property is a helper property that is used to determine whether data binding is required when the , , or property is changed.

  Returns a value indicating whether the control has been initialized.

- Method
  System.Void `` To be added

  Populates iteratively the specified with a sub-hierarchy of child controls.

  The control to be initialized from an inline template. 1.0.5000.0 2.0.0.0
- Property
  2.0.0.0
  System.Boolean To be added.

  The property is a helper property that determines whether the control is bound to an ASP.NET 2.0 data source control, such as an or a control.

  Gets a value indicating whether the property is set.

- Event
  System.Web.UI.WebControls.RepeaterCommandEventHandler

  This event is raised when a button in the control is clicked.

  This event causes a round-trip from the client to occur.

  For more information about handling events, see Consuming Events.

  Occurs when a button is clicked in the control.

  1.0.5000.0
  2.0.0.0
- Event
  System.Web.UI.WebControls.RepeaterItemEventHandler

  This event is raised when an item is created in the control.

  For more information about handling events, see Consuming Events.

  Occurs when an item is created in the control.

  1.0.5000.0
  2.0.0.0
- Event
  System.Web.UI.WebControls.RepeaterItemEventHandler

  This event is raised when an item in the control is data-bound.

  For more information about handling events, see Consuming Events.

  Occurs after an item in the control is data-bound but before it is rendered on the page.

  1.0.5000.0
  2.0.0.0
- Property
  System.Web.UI.WebControls.RepeaterItemCollection To be added: an object of type 'RepeaterItemCollection'

  The control populates the collection by enumerating every object in its . The collection is then used by the control to render each item in the control.

  Gets a collection of objects in the control.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.Browsable(false)
- Property
  System.Web.UI.ITemplate a

  Use this property to create a template that controls how items in the control are displayed.

  This control can be used to display user input, which might include malicious client script. Check any information that is sent from a client for executable script, SQL statements, or other code before displaying it in your application. ASP.NET provides an input request validation feature to block script and HTML in user input. Validation server controls are also provided to assess user input. For more information, see Validation Server Controls.

  Gets or sets the that defines how items in the control are displayed.

  1.0.5000.0
  2.0.0.0
  System.Web.UI.TemplateContainer(typeof(System.Web.UI.WebControls.RepeaterItem))
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.ComponentModel.DefaultValue(null)
  System.ComponentModel.Browsable(false)
- Method
  System.Boolean `` `` To be added

  Raises the event if the parameter is an instance of .

  true if the was raised, otherwise false.

  The source of the event. An object that contains the event data. 1.0.5000.0 2.0.0.0
- Method
  System.Void `` To be added

  Raises the DataBinding event.

  An object that contains the event data. 1.0.5000.0 2.0.0.0
- Method
  2.0.0.0
  System.Void

  The method is a helper method that is called when the , , or property is changed.

  Determines whether data binding is required.

- Method
  2.0.0.0
  System.Void `` ``

  The method is a helper method that participates in the data binding process. This method is called when the object that is associated data source control raises its event. The event causes the control to bind data to the updated data.

  Sets the property to true.

  The source of the event. An object that contains the event data.
- Method
  2.0.0.0
  System.Void `` To be added.

  Raises the event.

  An object that contains the event data.
- Method
  System.Void ``

  Raising an event invokes the event handler through a delegate. For more information, see Consuming Events.

  Raises the event.

  The object that contains the event data. 1.0.5000.0 2.0.0.0
- Method
  System.Void ``

  Raising an event invokes the event handler through a delegate. For more information, see Consuming Events.

  Raises the event.

  The object that contains the event data. 1.0.5000.0 2.0.0.0
- Method
  System.Void ``

  Raising an event invokes the event handler through a delegate. For more information, see Consuming Events.

  Raises the event.

  The object that contains the event data. 1.0.5000.0 2.0.0.0
- Method
  2.0.0.0
  System.Void ``

  The method notifies the control that it should perform actions that are common to each HTTP request for the page that it is associated with, such as setting up a database query. At this stage in the page life cycle, server controls in the hierarchy are created and initialized, view state is restored, and form controls reflect client-side data.

  Raises the event and performs other initialization.

  The object that contains the event data.
- Method
  2.0.0.0
  System.Void `` `` To be added. To be added. To be added. To be added.
- Method
  2.0.0.0
  System.Void ``

  The event is used to perform any updates before the output for the server control is rendered to the page. Any changes in the view state of the server control can be saved during this event. Such changes made in the rendering phase are not saved.

  Raises the event.

  The object contains the event data.
- Property
  2.0.0.0
  System.Boolean To be added.

  The control uses the property to determine whether the control needs to call the method to bind to its specified data source.

  Each time the set accessor is called on either the , , or property to change the data source after the method has already been called, ASP.NET sets the value of the property to true. The value of the property is also set to true when the method is called.

  ASP.NET sets the value of the property to false immediately after the method is called.

  Gets or sets a value indicating whether the control needs to bind to its specified data source.

- Property
  2.0.0.0
  System.Web.UI.DataSourceSelectArguments To be added.

  The first call to the object calls the method to create the object.

  Gets a object that the control uses when retrieving data from a data source control.

- Property
  System.Web.UI.ITemplate a

  Use the property to create a template that controls how the separator between items is displayed.

  You can use the property to display user input, which might include malicious client script. Check any information that is sent from a client for executable script, SQL statements, or other code before displaying it in your application. ASP.NET provides an input request validation feature to block script and HTML in user input. Validation server controls are also provided to assess user input. For more information, see Validation Server Controls.

  Gets or sets the interface that defines how the separator between items is displayed.

  1.0.5000.0
  2.0.0.0
  System.Web.UI.TemplateContainer(typeof(System.Web.UI.WebControls.RepeaterItem))
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.ComponentModel.DefaultValue(null)
  System.ComponentModel.Browsable(false)