I am looking for a good menu to use in an ASP.NET. I am currently using the asp menu. I need it to work in IE 6,7,8, Firefox and Safari. I also need it to not add a lot of overhead to the page client-side. I need to be able to load it from the database.
问题:
回答1:
Write your own Server Control which implements the asp.net menu control but go one step further and implement the CSS friendly adapters which will give you standards compliant code instead of the usual garbage html tables that asp:menu creates.
You can read more here: http://www.asp.net/cssadapters/Whitepaper.aspx
回答2:
You can use this code as inspiration: http://trac2.assembla.com/GiusCms/browser/trunk/Controls/Controls/Menu.cs
This control is able to use any SiteMapDataSource. Or you can simply customize it as you want. Use CSS to hide and show inner submenus.
回答3:
I came to this post because I was experiencing the whitespace issues using IE8. If anyone else is after a quick fix for this try to manually set the z-index property of the Menu item's DynamicMenuStyle property, here is what I did for the css for it.
.HorizontalMenu_DynamicMenuStyle
{
font-family: Verdana;
font-size: medium;
background-color: #FCFCFC;
border: solid 1px green;
z-index: 100;
}
And have a look at this
http://blogs.msdn.com/giorgio/archive/2009/02/01/asp-net-menu-and-ie8-rendering-white-issue.aspx
http://weblogs.asp.net/bleroy/archive/2009/03/23/asp-menu-fix-for-ie8-problem-available.aspx