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
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