Hi everyone here;
I have this code
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ArrayList olist = new ArrayList() { "aa", "bb", "cc", "dd" };
irepeater.DataSource = olist;
irepeater.DataBind();
}
foreach (RepeaterItem repitem in irepeater.Items)
{
Button ibutton = repitem.FindControl("btnhideshow") as Button;
ibutton.Click += new EventHandler(repbtn_Click);
}
}
void repbtn_Click(object sender, EventArgs e)
{
Label3.Text = "you clicked button item index: "; // + irepeater.Items. ;
}
<asp:Repeater runat="server" ID="irepeater">
<HeaderTemplate>
<table>
</HeaderTemplate>
<ItemTemplate>
<td>
<asp:Button ID="btnhideshow" runat="server" />
</td>
<tr>
<td>
<%#Container.DataItem%>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
I want to find the index of the button inside the repeater
it's look something like this;