This documentation is archived and is not being maintained.

RepeaterCommandEventArgs Class

Provides data for the ItemCommand event of a Repeater. This class cannot be inherited.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

Public Class RepeaterCommandEventArgs
	Inherits CommandEventArgs
Dim instance As RepeaterCommandEventArgs

public class RepeaterCommandEventArgs extends CommandEventArgs
public class RepeaterCommandEventArgs extends CommandEventArgs

For a list of initial property values for an instance of RepeaterCommandEventArgs, see the RepeaterCommandEventArgs constructor. For more information about handling events, see Consuming Events.

The following example illustrates a way to handle an ItemCommand event of the Repeater. Information about the button is displayed whenever a Button control within the Repeater is clicked.

<%@ Page Language="VB" AutoEventWireup="True" %>
    <script language="VB" runat="server">

    Sub Page_Load(Sender As Object, e As EventArgs)
        If Not IsPostBack Then
            Dim values As New ArrayList()
            values.Add(New PositionData("Microsoft", "Msft"))
            values.Add(New PositionData("Intel", "Intl"))
            values.Add(New PositionData("Dell", "Dell"))
            Repeater1.DataSource = values
        End If
    End Sub

    Sub R1_ItemCommand(Sender As Object, e As RepeaterCommandEventArgs)
        Label2.Text = "The " & CType(e.CommandSource, Button).Text & _
            " button has just been clicked; <br>"
    End Sub
    Public Class PositionData
        Private myName As String
        Private myTicker As String        
        Public Sub New(newName As String, newTicker As String)
            Me.myName = newName
            Me.myTicker = newTicker
        End Sub        
        Public ReadOnly Property Name() As String
                Return myName
            End Get
        End Property        
        Public ReadOnly Property Ticker() As String
                Return myTicker
            End Get
        End Property
    End Class
    <h3>Repeater Example</h3>
    <form runat=server>
       <asp:Repeater id=Repeater1 OnItemCommand="R1_ItemCommand" runat="server">
             <table border=1>
                <td> <%# DataBinder.Eval(Container.DataItem, "Name") %> </td>
                <td> <asp:Button Text=<%# DataBinder.Eval(Container.DataItem, "Ticker") %> runat="server" /></td>
       <asp:Label id=Label2 font-name="Verdana" ForeColor="Green" font-size="10pt" runat="server"/>

  • AspNetHostingPermission  for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.
  • AspNetHostingPermission  for operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0