Lets take an Example
<asp:Repeater ID="rptCategory" runat="server">
<HeaderTemplate>
<h2 style="margin-bottom: 5px; color: #008752!important;font-size:16pt;">
Course Categories</h2>
</HeaderTemplate>
<ItemTemplate>
<table cellpadding="2px" cellspacing="2px">
<tr>
<td>
<div runat="server" id="divleft" onmouseover="this.style.background='#BADFCE';" onmouseout="this.style.background='white';">
<asp:LinkButton ID="lnkCategory" runat="server" Text='<%#Eval("CategoryDescription")%>'
CommandArgument='<%# Eval("CourseLibraryCategoryID") %>' OnClick="lnkCategory_Click">
</asp:LinkButton>
</div>
</td>
</tr>
</table>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:Repeater>
Answer:
protected void lnkCategory_Click(object sender, EventArgs e)
{
//This is the code For Removing all style of Repeater Item
foreach (RepeaterItem item in rptCategory.Items)
{
LinkButton previous = item.FindControl("lnkCategory") as LinkButton;
(previous.NamingContainer.FindControl("divleft") as System.Web.UI.HtmlControls.HtmlContainerControl).Attributes.Remove("style");
previous.Attributes.Remove("style");
}
LinkButton temp = (sender as LinkButton);
temp.Attributes.Add("style", "color:green !important;");
(temp.NamingContainer.FindControl("divleft") as System.Web.UI.HtmlControls.HtmlContainerControl).Attributes.Add("style", "background-color:#BADFCE !important;");
}