Neudesic Blogs

Think Smart. Get Results.
Welcome to Neudesic Blogs Sign in | Join | Help
in Search

Pete Orologas

Menu Control Horizontal Layout - Asp.net 2.0

The Menu Control has to be one of the coolest and most frustrating controls I've worked with.  Anyways, if you're here to figure out how to make your control horizontal, you've come to the right place.

 

To begin set your SiteMapDataSource as shown below:

<asp:SiteMapDataSource ID="SiteMapDataSource2" runat="server" ShowStartingNode="false" StartingNodeOffset="0" /> 

 

<asp:Menu ID="Menu1" StaticDisplayLevels="2"  runat="server" Orientation="Horizontal" DataSourceID="SiteMapDataSource2"></asp:Menu>

Thats it!!! ( NOTE: The trick is the StaticDisplayLevel setting not the orientation) 

Here is the Web.Sitemap: everything in red is what will display in your menu

(IT should look like this)

Root     A     B    C

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
  <siteMapNode>
   
      <siteMapNode url="Default.aspx" title="Root"  description="" roles="">
        <siteMapNode url="A.aspx" title="A"  description="" roles="">
          <siteMapNode url="1.aspx" title="1"  description="" roles="" />
          <siteMapNode url="2.aspx" title="2"  description="" roles="" />
        </siteMapNode>
        <siteMapNode url="B.aspx" title="B"  description="" roles="">
          <siteMapNode url="3.aspx" title="3"  description="" roles="" />
          <siteMapNode url="4.aspx" title="4"  description="" roles="" />
        </siteMapNode>
        <siteMapNode url="C.aspx" title="C"  description="" roles="">
          <siteMapNode url="5.aspx" title="5"  description="" roles="" />
          <siteMapNode url="6.aspx" title="6"  description="" roles="" />
        </siteMapNode>
      </siteMapNode>


  </siteMapNode>
</siteMap>

If this helps you, give me a shout out.

Pete Orologas

 

Published Friday, April 28, 2006 2:15 AM by Porologas

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Karen said:

This is just what I was looking for. Thanks!
May 10, 2006 2:47 PM
 

Kade said:

Thanks! I spent the last hour trying to figure this out. Who knew it would be so simple?
May 15, 2006 1:50 PM
 

Suzanne said:

Yay Google and Yay Pete! Thanks for this tip; not sure why it's so hard to figure this out since almost every website in existence has their menu setup like this.
June 15, 2006 10:34 AM
 

Smolinitek said:

Thank you Pete for all of your help. This has helped me out a ton. Thanks again.
August 2, 2006 4:44 AM
 

Sara said:


Thanks a lot for this cool tip....it was very helpful

August 5, 2006 3:58 AM
 

matt said:

Thanks been looking for hours for that!
August 15, 2006 8:17 AM
 

joan said:

thanks!
August 25, 2006 3:27 AM
 

Øyvind said:

Great! Thank you very much! :o)
September 19, 2006 7:48 AM
 

shri said:

Thank you very much
December 27, 2006 2:17 AM
 

John P. Parlato said:

Thanks, just what I needed... Your post is much appreciated.  
January 6, 2007 4:36 PM
 

Dan Hay said:

Peter: I've been looking for a solution for this problem for some while, and this solution of yours was the best I couold find. Very elegant. Thank you, sir, for the help.
January 13, 2007 7:27 AM
 

Porologas said:

Thanks Dan, I'm glad I could help
January 15, 2007 2:18 PM
 

TC said:

Thanks Pete for this info. Very helpful.
January 18, 2007 1:02 AM
 

Chris said:

13 people said thanks make me 14.. thanks Pete
January 29, 2007 9:33 AM
 

Ashwin said:

the script was a gr8 help..

and now the count goes to 15,..
February 25, 2007 12:20 AM
 

kiran said:

This script has helped me very much. Thanks alot
March 2, 2007 3:22 AM
 

mike said:

this was great. thanks.
March 5, 2007 10:11 AM
 

Josh Blair said:

Thanks Pete.  This posting helped me a lot.  Big time saver.  Cheers.
March 13, 2007 12:15 AM
 

Mike said:

Thanks for the great posting - one question though - is there a way to insert a | character between the siteMapNode items so that it looks like this? -

Root | A | B | C

March 21, 2007 1:09 PM
 

jennifer said:

Very helpful!  Thanks.
April 10, 2007 7:15 AM
 

zwheeler said:

Thanks just what we were looking for.  Right on money. Oyyyy
April 16, 2007 11:04 AM
 

Andrew Von Gillern said:

Thanks very useful and time saving.
May 2, 2007 6:40 AM
 

atv tire said:

Hello! Very intheresting information. I'll return here regulary and I hope I would find more and more information. Thank you! Bye.
May 7, 2007 5:29 AM
 

Deepa said:

Thanks a lot for this! It really helped
May 31, 2007 5:36 AM
 

Jared said:

Nice, exactly what I was looking for.
June 20, 2007 9:02 AM
 

Helena said:

Very good tip.
June 28, 2007 9:07 AM
 

frank said:

THANKS!
July 31, 2007 11:55 AM
 

Danny Deng said:

thanks for helping solve this issue. I got the idea from you

and put a reference link to your web..
October 24, 2007 7:05 PM
 

Matt said:

This does not work.
October 27, 2007 12:52 PM
 

Trupti said:

This is just what I was looking for. Thanks!
October 30, 2007 9:44 PM
 

Brian said:

You are the man!  Thanks!
December 1, 2007 8:49 AM
 

Ralph said:

Thank goodness. Thank you!

I spent hours trying to find an answer to this!
December 28, 2007 10:22 AM
 

weedew said:

Thanks!
January 9, 2008 8:59 AM
 

Guygeboe said:

Thx! Just what I needed :)

Never knew it was just around the corner...
January 14, 2008 2:58 AM
 

Clarence Perdue Jr. said:

How much different is the ASP.NET native menu to
ASP.NET 2.0 CSS Friendly Control Adapters.
January 15, 2008 12:46 PM
 

Cesar Daniel said:

Thanks man!
January 24, 2008 7:37 PM
 

Ebony said:

THANK YOU SO MUCH!  Works Perfectly!
February 1, 2008 10:09 AM
 

Dan said:

Thanks much!
March 3, 2008 9:28 AM
 

Howard said:

I'm glad I found your site!  It was the perfect solution.  It is much appreciated.
March 16, 2008 8:35 AM
 

Jay said:

This is "complete" and perfect. Without attribute settings only the root node is shown.
March 22, 2008 1:54 PM
 

Bullet said:

Thanks - you've just saved what's left of my hair!!
March 31, 2008 7:17 AM
 

firefox said:

Thanks!
April 6, 2008 7:34 PM
 

Ashish Suman said:

thanks buddy....I was in search of that...
May 5, 2008 3:22 AM
 

Chopstik said:

Still learning a lot of the ins and outs, but this has helped with one immediate problem.  Thanks!
May 25, 2008 5:20 PM

What do you think?

(required) 
(optional)
(required) 

This Blog

Post Calendar

<April 2006>
SuMoTuWeThFrSa
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

Syndication

Powered by Community Server, by Telligent Systems