ASP.NET 4.0 – <asp:Menu> and semantic markup


By default, the menu control in ASP.NET 4.0 now renders tableless markup. Here’s the default ASP.NET Web Forms template (see my previous post) which uses an <asp:Menu> control for navigation.


Below you should be able to see it highlighted on the page (outlined in blue) and the corresponding markup in the IE8 Developer Tools window. You can see the <asp:Menu> renders as a <div> containing a <ul> of menu items rendered as <li> elements. This gives you scope to style it any way you choose.


(of course it is still possible to reinstate the old <asp:Menu> behaviour for backward compatibility).


menu





Comments (3)
  1. ccatto says:

    Hey Now Mike,

    Nice Post!

    Thx 4 the info,

    Catto

  2. Aj says:

    Hi Mike,

    Excellent news. Is any chance for sharepoint pages renders without table markup?  

  3. MikeO [MSFT] says:

    Hi Aj. Not sure TBH, haven’t had a chance to look at SharePoint 2010 as yet. Mike

Comments are closed.

Skip to main content