是不是vs2005的BUG,各位帮忙呀
我在使用Menu控件时,我想做到一个效果就是:
当选中某一个菜单项时,选中的菜单项字体为粗体,并且下划线消失(原本有下划线),为此我设置了StaticSelectedStyle属性,问题是现在选中后字体变粗了,但下划线依然存在,不知道为啥Font-Underline= "False "不起作用?
具体源码:
<%@ Page Language= "C# " AutoEventWireup= "true " CodeFile= "Default.aspx.cs " Inherits= "_Default " %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml " >
<head runat= "server ">
<title> 无标题页 </title>
</head>
<body>
<form id= "form1 " runat= "server ">
<div>
<asp:Menu ID= "Menu1 " runat= "server " Orientation= "Horizontal " Width= "206px ">
<StaticMenuItemStyle Font-Underline= "True " />
<StaticSelectedStyle Font-Bold= "True " Font-Underline= "False " ForeColor= "Black " />
<Items>
<asp:MenuItem Text= "test1 " Value= "test1 "> </asp:MenuItem>
<asp:MenuItem Text= "test2 " Value= "test2 "> </asp:MenuItem>
<asp:MenuItem Text= "test3 " Value= "test3 "> </asp:MenuItem>
</Items>
</asp:Menu>
</div>
</form>
</body>
</html>
[解决办法]
设置下超链接样式不知道行不行
[解决办法]
估计是bug,因为选中过的Item也包含了StaticMenuItemStyle的样式,所有还有underline
[解决办法]
估计是Bug,我这个打了SP1的还有下划线 CSS高手来
[解决办法]
ing
[解决办法]
lz太有才了
[解决办法]
只能用css了,放到head里面还不行 很奇怪
<body>
<style type= "text/css ">
.notunderline { text-decoration:none; }
</style>
<form id= "form1 " runat= "server ">
<div>
<asp:Menu ID= "Menu1 " runat= "server " Orientation= "Horizontal " Width= "206px ">
<StaticMenuItemStyle Font-Underline= "True " />
<StaticSelectedStyle Font-Bold= "True " CssClass= "notunderline " ForeColor= "Black " />
<Items>
<asp:MenuItem Text= "test1 " Value= "test1 "> </asp:MenuItem>
<asp:MenuItem Text= "test2 " Value= "test2 "> </asp:MenuItem>
<asp:MenuItem Text= "test3 " Value= "test3 "> </asp:MenuItem>
</Items>
</asp:Menu>
</div>
</form>
</body>
[解决办法]
<body>
<style type= "text/css ">
<!--
.myselectcss{
font-weight: bold;
color: #000000;
text-decoration: none;
}
-->
</style>
<form id= "form1 " runat= "server ">
<div>
<asp:Menu ID= "Menu1 " runat= "server " Orientation= "Horizontal " Width= "206px ">
<StaticMenuItemStyle Font-Underline= "True " />
<StaticSelectedStyle CssClass= "myselectcss " />
<Items>
<asp:MenuItem Text= "test1 " Value= "test1 "> </asp:MenuItem>
<asp:MenuItem Text= "test2 " Value= "test2 "> </asp:MenuItem>
<asp:MenuItem Text= "test3 " Value= "test3 "> </asp:MenuItem>
</Items>
</asp:Menu>
</div>
</form>
</body>
[解决办法]
帮顶
[解决办法]
up
[解决办法]
<%@ Page Language= "C# " AutoEventWireup= "true " CodeFile= "Default.aspx.cs " Inherits= "_Default " %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml " >
<head runat= "server ">
<title> 无标题页 </title>
<style type= "text/css ">
<!--
.myselectcss{
...
font-weight: ...;
color: ...;
text-decoration: ...;
}
.myselectcss a:visited{
font-weight: ...;
color:...;
text-decoration: underline;
}
.myselectcss a:hover{
font-weight: ...;
color: ...;
text-decoration: none;
}
.myselectcss a:active{
font-weight: ...;
color: ...;
text-decoration: none;
}
.myselectcss a:link{
font-weight: ...;
color: ...;
text-decoration: none;
}
-->
</style>
</head>
<body>
<form id= "form1 " runat= "server ">
<div>
<asp:Menu ID= "Menu1 " runat= "server " Orientation= "Horizontal " Width= "206px ">
<StaticMenuItemStyle Font-Underline= "True " />
<StaticSelectedStyle CssClass= "myselectcss " />
<Items>
<asp:MenuItem Text= "test1 " Value= "test1 "> </asp:MenuItem>
<asp:MenuItem Text= "test2 " Value= "test2 "> </asp:MenuItem>
<asp:MenuItem Text= "test3 " Value= "test3 "> </asp:MenuItem>
</Items>
</asp:Menu>
</div>
</form>
</body>
</html>
这样或许对楼主有用。