I want to set forecolor and backcolor of the first button in a repeater control everytime the page loads.
This is what I try
and it does nothing
how do you know if you are on the first control?
This is what I try
Code:
protected void Repeater1_ItemCreated(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Button lb = (Button)e.Item.FindControl("ListButton");
if (e.Item.ItemIndex == 0)
{
lb.ForeColor = System.Drawing.Color.White;
lb.BackColor = System.Drawing.ColorTranslator.FromHtml("#5D7B9D");
}
}
}
how do you know if you are on the first control?