apply custom styles to anchor tag inside div from code behind

zeroty

New Member
here i want to apply custom styles to anchor tag inside div from code behind.here is my code.here am applying several styles. font family is applying but font color and font size is not applying\[code\]<div id="sidenav" style="height:600px" runat="server"> <ul id="abcd" runat="server" style="margin-top:30px;"> <li>><a href="http://stackoverflow.com/questions/14516526/ViewEvents.aspx">Events</a></li> <li>><a href="http://stackoverflow.com/questions/14516526/PhotoGalleries.aspx">Photo Galleries</a></li> <li>><a href="http://stackoverflow.com/questions/14516526/InProgress.aspx">Location</a></li> <li>><a href="http://stackoverflow.com/questions/14516526/InProgress.aspx">Officials</a></li> <li>><a href="http://stackoverflow.com/questions/14516526/InProgress.aspx">Honours Board</a></li> <li>><a href="http://stackoverflow.com/questions/14516526/InProgress.aspx">History</a></li> <li>><a href="http://stackoverflow.com/questions/14516526/InProgress.aspx">Links</a></li> <li>><a href="http://stackoverflow.com/questions/14516526/InProgress.aspx">Site map</a></li> <li>><a href="http://stackoverflow.com/questions/14516526/InProgress.aspx">Help</a></li> </ul> <span id="myspan" runat="server">&nbsp;</span> </div> foreach (Control c in sidenav.Controls) { string abc = abcd.InnerText; abcd.InnerHtml = "<font ForeColor='" + objpage.NavigatioinTextcolor + "'>" + abc; //abc.Style.Add("color", objpage.NavigatioinTextcolor); } abcd.Style.Add("background-color", objpage.NavigationBackcolor); ////abcd.Style.Add("ForeColor", objpage.NavigatioinTextcolor); ////sidenav.Style.Add("color", objpage.NavigatioinTextcolor); ////sidenav.Style.Add("ForeColor", objpage.NavigatioinTextcolor); abcd.Style.Add("font-family", objpage.NavigatioinTextStyle); abcd.Style.Add("font-size", objpage.NavigatioinTextsize); abcd.Style.Add("font-size", string.Format(objpage.NavigatioinTextsize + "px")); abcd.Style.Add("style", "font-size:" + string.Format(objpage.NavigatioinTextsize + "px"));\[/code\]
 
Back
Top