Home » Asp.net

Horizontal submenu in asp.net 2.0

','')).replace('',''); } else { var RowAttributes=(((Row.outerHTML.replace(TDText,'')).replace('','')).replace('',''); } var TDWithAttributes="
I'm building a site that requries a horizontal submenu.  Is it possible to configure the existing control in asp.net 2.0 to do that?  If not can anyone tell me of a control that would do that?

Thanks in advance,


21 Answers Found


Answer 1


You can use the ASP.NET menu control  with Orientation property set to horizontal.

Hope this helps,



Answer 2

Actually I'm looking for a horizontal  submenu.  The top part was easy.  I'm actually playing around with a menu by obout called EasyMenu.  It looks like it'll do everything I need.  It's free too!  Imagine that.  Anyway if anyone knows how to make the default ASP.Net menu control  have horizontal submenus then post the answer here.  Otherwise you guys should check out EasyMenu by obout.  It's not the most userfriendly for programmers but once you get the hang of it it seems pretty cool!  It's in the controls section of this site.  


Answer 3

Thanks for the Easy Menu option. But alas! its free for pesonal use only.

Anyways, you can try having horizontal  sub menus by customizing the way ASP.NET menu control  renders using CSS Control Adapter Toolkit. I have not used it for horizontal sub menus but i believe that must be possible. See this post and download link:



Hope this helps,



Answer 4

I know but if it works out I think I'll buy it.  (actually get my client to buy it... :) )

I've tried working with the CSS adapter toolkit and I've seen that article.  I've yet to be able to create a horizontal  submenu for it yet. :(  

Thanks for trying.  If I get it to work I'll post the solution here.  (anyone else interested in this?)


Answer 5

has there been any solution for this? I'm surprised that such a common requirement would be so difficult to implement using the .net controls.  Tab navigation with horizontal  submenus is a fairly common theme amongst webpages

Answer 6

I have tried CSS Adapter toolkit for that. the final conclusion was that it requires some changes to Java Script and CSS.

Never finished that, found more simple solution , not perfect, but works now. Multiple XML datasources been created... Each main menu item has a seperate XML file...


Answer 7

Why does MIcrosoft not include this as a control?  It's a glaring hole, IMO.  There is no code offered by any enterprising programmer for horizontal  css menus and submenus?  Could someone point out a link to one with source that doesn't cost money?  I wouldn't mind paying the money--it's that normally those who charge it, in a rationalization for the money, but everything including the kitchen sink in it.  I simply want one that shows a simple dropdown menu and submenu.

Thanks if anyone can show me a link.


Answer 8

for this problem, I eventually wrote my own custom control  to generate the unordered lists html that I needed for this.  I then used css to style the tab menu to my liking.  Unless you can find a better solution, this was one way to solve the problem.

Answer 9

Do you have an example of your CSS menu? I would like to create my own CSS based .Net control  using DB access but before I start would be nice to see if anyone has done it before?

I'm interested specifically in the VB to search through something (like a dataset) to look for parent child relationships for the menu.





Answer 10

wait, I'm sorry. I'm kind of unclear on what you're l;ooking for.  Are you loking for the html code rendered by the custom control? It would render something to this effect.

<div class="topNav">
<li class="selected"><a href="http://forums.asp.net/AddPost.aspx?PostID=1616737#">One</li>
<li><a href="http://forums.asp.net/AddPost.aspx?PostID=1616737#">Two</li>

<div class="subNav">
<li class="selected"><a href="http://forums.asp.net/AddPost.aspx?PostID=1616737#">One</li>
<li><a href="http://forums.asp.net/AddPost.aspx?PostID=1616737#">Two</li>

 I'm not the best at all this and I may be missing some stuff, but this should get you somewhat started.  Once your custom control  renders this html, you are able to take this html code and use css to style menus


Answer 11


Thanks for the Easy Menu option. But alas! its free for pesonal use only.

Anyways, you can try having horizontal  sub menus by customizing the way ASP.NET menu control  renders using CSS Control Adapter Toolkit. I have not used it for horizontal sub menus but i believe that must be possible. See this post and download link:



Hope this helps,



Hi ,

I am looking for a way to have Horizontal menu that is openning to Horizontal Submenu.

on the link you have here i dont see in the examples the possibility to have horizontal sub menu.(it is open to vericale menu)

 is anybody can please advice how should i have horizontal submenu  ?


thanks for the help




Answer 12

yeah i need to know how to do this too :/ HELP! having a hard time w/twocolorsmenu

Answer 13

Looking at the source, it seems that the reason the sub-menu items display in rows is that they are specifically rendered as "tr" elements within a table.  The only, very sad, hack I've found around this so far is to apply a style to all "tr" elements in your page that specify "display: inline" as a style.  This will at least cause your sub-menu to appear horizontally.  However, this of course means that you will need to apply a more specific style using a class or id to all other tr elements in your site  to revert their rendering back to the natural state of "display: block".  If you try to use a vertically-oriented menu control  on a page using the same stylesheet , you run into problems because the Asp:menu control doesn't allow for specific classing of the tr and td elements it renders out.  Anyway, just some thoughts that might provoke further discussion.

 Later note --

Quick refinement.  I would recommend setting the DynamicMenuStyle-CssClass property to the name of a class such as "Class1", then in the stylesheet, have a block that specifies that all tr tags within that class should be
displayed inline.  This targets the style so it doesn't affect all tr tags.  Source code example:

ASPX File 

<asp:Menu ID="mnuTopNav"  runat="server" Orientation="Horizontal" DynamicMenuStyle-CssClass="Class1"  ></asp:Menu>

CSS File

.Class1 tr { display:inline; }




Answer 14

Did you find an answer to the submenu  problem?

Answer 15

Try Ultimate Menu  It has an option for "All horizontal"


Answer 16

Did changing the DynamicMenuItemStyle-CSSClass property to a CSS selector that told "td" tags to be inline not help? 


Answer 17

Hi! I have had this problem too. I fixed it with the css solution for the tr but only works in Firefox. Not in IE.

Im don't know much about CSS so I don't know what else to do to make i work in IE too :(


Any help please?




Answer 18

I have found a great website that has plenty of CSS menus (horizontal AND vertical), that are free.  Some you have to "request permission" to use.

 Check out:


I really like:



Answer 19

Hi all

I'm having the same problem

I need a Main menu that could be bound to a site  map and  display a horizontal  sub menu.

please if abyone knows about this tell us.



Answer 20

We can achive Horizontol Submenus in ASP.Net. Add this Script in ASPX file function LoadHorizontalSubMenus(MainMenuIndexs) { try { var ClientID=''; var SubMenuIndex=MainMenuIndexs.split(','); for(var i=0;i
"; //TDText=TDWithAttributes+TDText.substring(4,TDText.length); TDText=TDWithAttributes+TDText.replace(/^\s+/,"").substring(4,TDText.length); TRText=TRText+TDText; } } FormatedSubMenuDesign=""+TRText+"
"; if(FormatedSubMenuDesign!="") { document.getElementById(ClientID+"_mnuMainMenun"+SubMenuIndex[i]+"Items").innerHTML=''; document.getElementById(ClientID+"_mnuMainMenun"+SubMenuIndex[i]+"Items").innerHTML=FormatedSubMenuDesign; } } } catch(ex) { alert(ex); } } function getOuterHTML(obj) { var temp=obj.cloneNode(true); var Objdiv=document.createElement("div"); Objdiv.appendChild(temp); var outer=Objdiv.innerHTML; return outer; } //Add this in CS File CS File protected void Page_Load(object sender, EventArgs e) { ///Code For Horizontal Sub Menus..... ///mnuMainMenu is MenuConteol Name try { string MainMenuIndexes = ""; for (int i = 0; i 0) MainMenuIndexes += i.ToString() + ","; } if (MainMenuIndexes != "") Page.ClientScript.RegisterStartupScript(typeof(string), "onloadValidation", "LoadHorizontalSubMenus('" + MainMenuIndexes.ToString() + "');", true); } catch (Exception ex) { Label lblMesssage = new Label(); iAssureGlobalMethods.HandleException(uiReturnPageObject, ex, "Page_Load", lblMesssage); } }

Answer 21

One can try by this http://www.codeproject.com/KB/aspnet/HorizontalSubmenu.aspx

This may help more their who try to develop a horizontal  menu with horizontal submenu  from scratch using asp.net menu control.




I have an asp.net file with a 2 level menu.  I changed the menu background to transparent.  When I run the page in the Expression Development Server it works fine but I upload the file to GoDaddy.com hosting and the submenu items display with a white background.  Is there a way to fix this and why does it behave differently in EDS and ASP.net from Godaddy?


I also created my own IIS server and posted the page with the same results.




Hopefully someone can help.

I have an asp.net menu with horizontal static top tier followed by 2 dynamic vertical lower tiers.

It renders fine in all other browsers etc. etc. - apart from IE6.

In IE6 the menu is not rendered horizontally and insttead the items are stacked vertically.

It is my understanding that when using horizontal orientation, the menu items are effectively floated next to each other. 

So I can get round this float problem in IE6 by specifying a width for the items i.e.:


*html .AdminMenu .AspNet-Menu-Horizontal ul.AspNet-Menu li
	width: 45px;
	text-align: left;

Problem is, I do not want to set the width for each item. If I do this then it means regardless of the length of the text the width will always be the same.

On other browsers I do not set a width but instead set left/right margin so that every item is evenly spaced.

How can I do this in IE6? Essentially each li should wrap the text and float next to eachother.

Many thanks.




I have a an asp:Menu with a datasource and the page is being accessed by https. If I hover over one of the menu items that has a subitem I get this popup.

Here is my code,

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="UI_Common_Test" %>

<!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">
    <form id="form1" runat="server">
        <asp:Menu ID="Menu1" runat="server" DataSourceID="dsSiteMap" Orientation="Vertical"
                <asp:MenuItemBinding DataMember="SiteMapNode" TextField="Title" />
        <asp:SiteMapDataSource ID="dsSiteMap" runat="server" SiteMapProvider="Public" />


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class UI_Common_Test : BasePage
    protected void Page_Load(object sender, EventArgs e)


    <siteMap defaultProvider="Public">
        <add name="Public" type="System.Web.XmlSiteMapProvider" siteMapFile="~/Navigation/Public.sitemap"/>

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
  <siteMapNode url="~/validpage.aspx" title="Home" >
    <siteMapNode url="~/validpage2.aspx" title="Page2" />
    <siteMapNode url="~/validpage3.aspx" title="Page3">
      <siteMapNode url="~/validpage4" title="Page4" />


I am using asp:menu control.

it works fine in IE 8, but in firefox 3.6 submenu, it shows only one submenu item even if there are multiple items.

is there any solution to this, please help.


I am using asp:menu.

It shows submenu properly in IE 8, but in FF 3.6 it shows only one submenu item.

I seen some posts which were suggesting to remove height from css. After removing height it is the same, still problem persists.

Please help me to solve this.


I am needing to display data with both row and header labels based on a param passed from another aspx.  I've got that working, but I want to display the results with both row and column headers, per the example below.  What, if any, control could be used to get this effect?  I'm coding in C#.

Wages                  Amount               YTD Amount

Gross                    999.99                   1999.99

Fed Taxable          999.99                   1999.99

FICA Taxble          999.99                    999.99



I am using the <asp:menu> in a master page to create a common menu throughout my web application.  Orientation is set to Horizontal yet the menu items are generated vertically.  In addition, each item takes up the entire width of the browser page.  Any suggestions?




HI Good Guys,

I am using VB.NET2008 with ASP.NET 2008 using VB.

I am trying to create WEB Application with WEB SERVICE and normal ASP.NET FORM.  

I don't know how to create the WEB SERVICE and also how to link the ASP.NET FORM to it as well.

I am trying to locate a Tutorial that will guide and teach me how to develop it.

Please help me.


Thanks you,

Have a Good Day.






visit my blog and please give me a feed back...







hello, it's me again :-)

a (maybe) stupid question:

in asp.net 3.5 i've this .browser file:


<browser refID="safari1plus">


<adapter controlType="System.Web.UI.WebControls.Menu" adapterType="" />





now i suppose that in asp.net 4.0 this is not useful.

So what i've to do? I've simply to delete "App_Browsers" folder in my converted project or i've to put in this folder:














What's the best way?

Thank  you very much!



Hi All,

We have an ASP .NET web application developed in VS 2003 i.e. framework 1.1.

We don't want install framework 1.1 on the server. Can we deploy this application without migrating to VS 2005 with only framework 2.0 installed on the server?






I am also very interested to know, when the first service pack of Visual Studio 2010 will be released, because I encountered a serious bug when remote debugging an asp.net or asp.net mvc application.

This bug is reported, see:

Without beeing able to remote debug I cannot develop my next (big) project.
So when there is "no service pack timeline for Visual Studio 2010" I need another way to get this bug fixed as soon as possible, because I simply cannot wait an indefinite time.

What can I do for a solution of this problem?

Horst Seyfried


I was tested "Expanding the Range of Allowable URLs" for this ASP.NET 4 new feature.  The maxUrlLength attribute under <httpRuntime> section in the web.config is only apply to ASP.NET 4 Web Form files.  I couldn't use this feature in ASP.NET MVC 2 that run under ASP.NET 4 application pool.  Does anyone know this problem? 


hi all,

i am new to web developement... 

i just want to follow a tutorial that guide through how to create a asp webpage

i have VS2005 and microsoft .net framework 3.5 installed 

but when i click on NEW Website in VS2005, i cannot find teh new ASP.Net Web Application like in this articale is showing


but i can only see  ASP.Net Web Site + ASP.Net Web Services + Personal Web Site Starter Kit + Empty Website + ASP.Net Crystal Report Web Site


PS. when i intalled Vs2005, I choosed Full Install.


please let me know if i am missing something. or, does a ASP.Net Web Application and ASP.Net Web Site will bring you the same thing.

however, one thing i notice is that after i create new ASP.Net Web Site, i can't find the Property and or Refference NODE in the Website project-node anywhere. (figure 2 in the above link will give you a better picture of what i am trying to explain)



Can anyone please explain why will anyone go in for asp.net MVC since we can easily implement in asp.net 


I wanted to know if AJAX 2.0 version is compatible with ASP.Net 2.0 ?

Thanks in Advance


Insert html tage to sqlserver database through asp.net textbox

Display it lable control

Best regards


I failed to get help for this on StackOverflow, so I'm going to ask here.

I've inherited an ASP.net web forms application.

I've been getting some weird error messages, and I've narrowed down the cause to a single web control. (Some other pages have similar issues with other web controls, but I'm using a test page with a single web control for illustrative purposes.)

I created a blank new page in my web forms application called testPage.aspx.  In the page, I created a single asp:Menu control and bound it to "web.sitemap".  When I run the page on my development workstation, there is no problem.  The control works fine.

When I deploy this page to my production server, it is another story.  When I hit www.myserver.com/testpage.aspx, I intermittently have the following 3 problems:

1) The icon for the menu fails to load (missing image icon shows instead)

2) The javascript fails to load ("asp.net ajax client framework failed to load" error) and the menu options won't appear.

3) The page entirely fails to load.

There errors happen intermittently.  The page might load 30 times in a row with no problem, and then the next 30 times, the javascript errors pop up.

I've spoken to the network admin.  He says that www.myserver.com is actually routed to three web servers.  In my development environment, I can hit them as,, and  Guess what?  When I go to my workstation in the development environment and hit, it works fine every single time.  Same thing with and!  It looks like the error has something to do with the network setup.

Another developer in my office noticed that WebResource.axd was intermittently getting re-routed to error.aspx.

What should I do?

While I have heard a lot of discussions about the pros and cons of ASP.NET MVC and webforms, and that there are cases where either one will be a good fit, I think this is ambigious and only reflects a dilemma facing technical decision makers: ASP.NET MVC is politically correct architecturally, but it is still too primitive for real world development, webforms 4.0 has kind of eliminating the weakness of previous web forms, but it is still a Page Controller.

So for enterprise environment where we are talking about large scale projects serving tens of thousands of users, should we adopt ASP.NET MVC today? It is kind of disappointing that the so called 2.0 of ASP.NET MVC is still so primitive. I like to seek feedback from Architects on this issue and your decision points, any comment will be deeply appreciated.

My Html Page
<table id="ritu">
   <tr><td> Name</td> <td><td><td><td></tr>
   <tr><td> Father Name</td> <td><td><td><td></tr>
   <tr><td> Age</td> <td><td>Sex<td><td></tr>

  My Output is
     <asp:lable id="lbl_Name" runat="server/>
    <asp:textbox id="txt_Name runat="Server"/>

   <asp:lable id="lbl_FatherName" runat="server/>
    <asp:textbox id="txt_FatherName" runat="Server"/>

<asp:lable id="lbl_Age" runat="server/>
    <asp:textbox id="txt_Age runat="Server"/>
<asp:lable id="lbl_sex" runat="server/>
    <asp:textbox id="txt_sex runat="Server"/>


<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure