I'm using literal to implement css, so as to have the css class vary depending on the page I'm on, the css being applied to some "a" tags also.
That bit (variable css on a tags) seems to be working for me at present for some reason, but the code breaks the use of the ~/
within 开发者_开发知识库links...
Does anyone know if there any consequences of using the below but limiting my pages to the root folder - as it does seem to be working there at least:
<li>
<a <asp:Literal id="ClassToUse" runat="server"/> id="home_link"
href= "Default.aspx" title="Home" onfocus="this.blur();" runat="server">Home</a>
</li>
Or if it is possible to get the path from root (~/
) working within it, so as to enable a better folder layout/hierarchy.
I don't have an Openid and have given up on trying to sign in - for a while.
A few alternatives come to my mind:
- Use a
<asp:Hyperlink>
and set CssClass property of the hyperlink instead of setting the value of the ClassToUse literal. - Fix the CSS class name of the link but change the CSS definitions by putting the
<style>
section on your page into a changeable literal.
But it's also possible that I misunderstood your question...
Thanks for the help Heinzi - this one got both working together for me... Went "You beauty" when it worked :)
<li><asp:Hyperlink id="ClassToUse" runat="server" NavigateUrl="~/Default.aspx" title="Home" onfocus="this.blur();">Home</asp:Hyperlink></li>
Case "Default.aspx"
' switch the background pics for the li
ClassToUse.CssClass = "active"
精彩评论