To customize the styling of link buttons by adding a CssClass, you can include the following code:
<asp:LinkButton ID="LinkButton1" runat="server" CssClass="linkbtn" />
You can then specify the highlighted style in CSS like this:
.linkbtn .highlighted { color: red; }
Furthermore, utilize JavaScript to toggle classes. Here is an example using jQuery:
$(".linkbtn").click(function () {
$(".linkbtn").removeClass("highlighted");
$(this).addClass("highlighted");
});
In ASP.Net, simply do the following:
<asp:LinkButton id="LinkButton4" OnClick="LinkButton4_Click" runat="server"/>
And in the codebehind section:
private void SetHighlighted(LinkButton btn)
{
LinkButton1.CssClass = "";
LinkButton2.CssClass = "";
LinkButton3.CssClass = "";
LinkButton4.CssClass = "";
LinkButton5.CssClass = "";
btn.CssClass = "highlighted";
}
protected void LinkButton4_Click(object sender, EventArgs e)
{
SetHighlighted((LinkButton)sender);
}
Repeat the above steps for every link button on your page.