CSS call from code behind not working
Posted
by SmartestVEGA
on Stack Overflow
See other posts from Stack Overflow
or by SmartestVEGA
Published on 2010-03-08T06:26:53Z
Indexed on
2010/03/08
6:36 UTC
Read the original article
Hit count: 263
I have the following entries in the css file.
a.intervalLinks { font-size:11px; font-weight:normal; color:#003399; text-decoration:underline; margin:0px 16px 0px 0px; }
a.intervalLinks:link { text-decoration:underline; }
a.intervalLinks:hover { text-decoration:none; }
a.intervalLinks:visited { text-decoration:underline; }
a.selectedIntervalLink { font-size:12px; font-weight:bold; color:#003399; text-decoration:none; margin:0px 16px 0px 0px; }
a.intervalLinks:active { text-decoration:underline; font-size:large ; }
Whenever i take the click on some links (not shown) which is embedded in the webpage ..i can see the change in the link
a.intervalLinks:active { text-decoration:underline; font-size:large ;
(the font of the link will become large)
but after clicking the page refreshes ..the changes will go away
i want to keep the change for ever in that link ...even there is a page refresh
i understood that ..this can achieved only throughg the code behind of asp.net
Following code should work:but unfortunately its not ..could anyone help?
protected override void OnInit(EventArgs e)
{
rptDeptList.ItemDataBound += new RepeaterItemEventHandler(rptDeptList_ItemDataBound);
}
void rptDeptList_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.DataItem == null)
return;
LinkButton btn = (LinkButton)e.Item.FindControl("LinkButton1");
btn.Attributes.Add("class", "intervalLinks");
}
Current html code for links has been shown below :
<ItemTemplate>
<div class='dtilsDropListTxt'><div class='rightArrow' ></div>
<asp:LinkButton ID="LinkButton1" runat="server" Text=<%#DataBinder.Eval(Container.DataItem, "WORK_AREA")%>
CssClass="intervalLinks" OnClick="LinkButton1_Click" ></asp:LinkButton>
</div>
</ItemTemplate>
Could anyone help?
© Stack Overflow or respective owner