Repeater Item?

A

Arpan

Assume that a Repeater control displays 2 columns in a HTML table (i.e.
using <tr><td> etc.) - Name & Phone no. All the items under the "Name"
column are LinkButtons. To retrieve the index of the item clicked, this
is what I did:

<script runat="server">
Sub ComItem(ByVal obj As Object, ByVal ea As
RepeaterCommandEventArgs)
Response.Write(ea.Item.ItemIndex)
End Sub
</script>
<form runat="server">
<asp:Repeater ID="rptrUsers" OnItemCommand="ComItem" runat="server">
<HeaderTemplate>
<table border="1">
<tr>
<th>NAME</th>
<th>PHONE NUMBER</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
...................
...................
...................
</asp:Repeater>
</form>

The above code retrieves the ItemIndex but how do I get the actual data
of the item that the user has clicked?

For e.g. assume that the first 3 items under the "Name" column are,
say, Clive, Vivian & Maria. Now when the user clicks Vivian, the
Response.Write line should output "Vivian" or if the user clicks Maria,
the Response.Write line should output "Maria". How do I do this?

Thanks,

Arpan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

DataBind 1
DataBind In ItemDataBound Event 1
OnItemCommand & OnItemDataBound 2
Why image is not showing in repeater 1
IsPostBack 4
Repeater OnItemCommand 1
ViewState? 1
Reference control in Repeater Control 4

Top