hi everyone;
I have this code
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ArrayList olist = new ArrayList() {"visible", "invisible", "visible", "visible", "visible", "invisible", "visible", "visible", "invisible"};
for (int i = 0; i <= olist.Count-1; i++)
{
if (olist[i].ToString() == "visible" )
{
foreach (RepeaterItem repitem in irepeater.Items)
{
Button ibutton = repitem.FindControl("btnhideshow") as Button;
ibutton.Text = "hey! I am Visible";
}
}
else {
foreach (RepeaterItem repitem in irepeater.Items)
{
Button ibutton = repitem.FindControl("btnhideshow") as Button;
ibutton.Visible = false;
}
}
}
irepeater.DataSource = olist;
irepeater.DataBind();
}
foreach (RepeaterItem repitem in irepeater.Items)
{
Button ibutton = repitem.FindControl("btnhideshow") as Button;
ibutton.Click += new EventHandler(repbtn_Click);
}
}
I want to hide the button if records found "invisible".
the output must be like this:

-----------------------------------------------------------------------------------------------------
another question is
I want to get the button index value inside the repeater row, when the user click the button the index value display one Label3
void repbtn_Click(object sender, EventArgs e)
{
Label3.Text = "The button item index that clicked in the repeater is: "; // + irepeater.Items. ;
}
thanks in Advance