Home » Asp.netRSS

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,

M
 

21 Answers Found

 

Answer 1

Hi,

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

Hope this helps,

Vivek

 

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.  

M
 

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:

http://weblogs.asp.net/scottgu/archive/2006/05/02/CSS-Control-Adapter-Toolkit-for-ASP.NET-2.0-.aspx

http://www.asp.net/cssadapters/

Hope this helps,

Vivek

 

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?)

M
 

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.

 
Thanks,

 

Nasha
 

 

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">
<ul>
<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>
</ul>
 </div>

<div class="subNav">
<ul>
<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>
</ul>
 </div>

 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

vivek_iit:

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:

http://weblogs.asp.net/scottgu/archive/2006/05/02/CSS-Control-Adapter-Toolkit-for-ASP.NET-2.0-.aspx

http://www.asp.net/cssadapters/

Hope this helps,

Vivek

 

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

 

Ori

 

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?

 

Thanks!

 

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:

 http://www.cssplay.co.uk/menus/

I really like:

http://www.cssplay.co.uk/menus/pro_droptab.html#nogo

 

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.

thanks.

 

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.

 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter