Solved

Menu control static/dynamic, horizontal orientation

Posted on 2009-06-30
6
813 Views
Last Modified: 2012-05-07
Hello - I must be misunderstanding the whole "static/dynamic" thing; I'm trying to get a static horizontal row of 3 (4, if you count "Home") menu areas, each with 2-4 selections, which I thought would drop down when selected or hovered over.

I'm not trying to do anything fancy (yet); just trying to get it working with basic defaults

As it is, they all just display in one row, like
Home   Personnel   Hiring   Training   Certifications   Personnel  Center Operations   Permits   Safety   Maint and Repairs   Centers    Admin   Users   Lookups
 
(It's funny; when I swiped over the rendered display in the browser and pasted it in here, it pasted in with the hierarchical line breaks & indentation, like I would have expected if was oriented vertically, with all nodes expanded...  :-(

How do I get "drop-down" behavior for the menu items?

(ASP.NET 3.5 / Visual Web Developer 2008 Express)

Thanks
 


Web.sitemap:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
  <siteMapNode title="Home" description="Home" url="~/home.aspx" >
    <siteMapNode title="Personnel" description="Personnel!" url="~/PersMain.aspx">
      <siteMapNode title="Hiring" description="Hiring!" url="~/ActvsHrngList.aspx" />
      <siteMapNode title="Training" description="Training!" url="~/ActvsTrngList.aspx" />
      <siteMapNode title="Certifications" description="Cert's!" url="~/ActvsCertsList.aspx" />
      <siteMapNode title="Personnel" description="Personnel Info Maintenance" url="~/PersList.aspx" />
    </siteMapNode>
    <siteMapNode title="Center Operations" description="Center Operations!" url="~/SitesMain.aspx">
      <siteMapNode title="Permits" description="Permits!" url="~/ActvsPrmtsList.aspx" />
      <siteMapNode title="Safety" description="Safety!" url="~/ActvsSftyList.aspx" />
      <siteMapNode title="Maint and Repairs" description="MnR!" url="~/ActvsMnRList.aspx" />
      <siteMapNode title="Centers" description="Center Info Maintenance" url="~/SitesList.aspx" />
    </siteMapNode>
    <siteMapNode title="Admin" description="System Administration" url="~/AdmnMain.aspx">
      <siteMapNode title="Users" description="User Info Maintenance" url="~/UsersList.aspx" />
      <siteMapNode title="Lookups" description="Lookups Maintenance" url="~/LkupsList.aspx" />
    </siteMapNode>
  </siteMapNode>
</siteMap>
 
 
Menu control mark-up:
            <asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1" 
                    Orientation="Horizontal" StaticDisplayLevels="3" MaximumDynamicDisplayLevels="4">
            </asp:Menu>

Open in new window

0
Comment
Question by:mlagrange
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 20

Expert Comment

by:ddayx10
ID: 24750383
Looks like your xml just needs a small adjustment. You were surrounding all the nodes with the home node and so they were all children of HOME. If that's not it Ill set it up and figure it out for ya.
Web.sitemap:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
  <siteMapNode title="Home" description="Home" url="~/home.aspx" />
    <siteMapNode title="Personnel" description="Personnel!" url="~/PersMain.aspx">
      <siteMapNode title="Hiring" description="Hiring!" url="~/ActvsHrngList.aspx" />
      <siteMapNode title="Training" description="Training!" url="~/ActvsTrngList.aspx" />
      <siteMapNode title="Certifications" description="Cert's!" url="~/ActvsCertsList.aspx" />
      <siteMapNode title="Personnel" description="Personnel Info Maintenance" url="~/PersList.aspx" />
    </siteMapNode>
    <siteMapNode title="Center Operations" description="Center Operations!" url="~/SitesMain.aspx">
      <siteMapNode title="Permits" description="Permits!" url="~/ActvsPrmtsList.aspx" />
      <siteMapNode title="Safety" description="Safety!" url="~/ActvsSftyList.aspx" />
      <siteMapNode title="Maint and Repairs" description="MnR!" url="~/ActvsMnRList.aspx" />
      <siteMapNode title="Centers" description="Center Info Maintenance" url="~/SitesList.aspx" />
    </siteMapNode>
    <siteMapNode title="Admin" description="System Administration" url="~/AdmnMain.aspx">
      <siteMapNode title="Users" description="User Info Maintenance" url="~/UsersList.aspx" />
      <siteMapNode title="Lookups" description="Lookups Maintenance" url="~/LkupsList.aspx" />
    </siteMapNode>
  
</siteMap>
 

Open in new window

0
 

Author Comment

by:mlagrange
ID: 24750597
Well, I'm matching some other samples that all have it laid out that way:
http://aspnet.4guysfromrolla.com/demos/printPage.aspx?path=/articles/111605-1.aspx
http://msdn.microsoft.com/en-us/library/ecs0x9w5(VS.80).aspx

I just realized about the StaticDisplayLevels; I set it to 2, and got the top level (Home), and the 2nd levels (Personnel, Center Op's, Admin)

But I still don't get the items below that, when I click on those 2nd level items.

And a strange thing - when I change the "MaximumDynamicDisplayLevels" to "3" on the property sheet of the Menu control, the "3" stays normal font weight, and that attribute dissappears from the Menu control markup. When I change it to "1", the "1" values comes back in bold, and that attrib re-appears in the markup. It's like it knows, that given everything else, that isn't a valid value???

By all means, please set it up the way you think it would work (I see in your response that the closing tag for the Home node is blanked out; did you do that on purpose? )
0
 
LVL 20

Expert Comment

by:ddayx10
ID: 24750635
Did you test it? Does it solve the problem? Yes I removed the closing tag for the Home node, and closed that node inline />. It was just a quick edit going on the premise that fresh eyes may have easily been able to see your issue.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:mlagrange
ID: 24750833
I copied your entire <sitemap> in; the "<siteMapNode title="Personnel..." gets a blue squiggly, and the error message "element SiteMap has invalid child element"
0
 
LVL 20

Accepted Solution

by:
ddayx10 earned 500 total points
ID: 24750855
OK well as far as I can tell your original code was fine (so much for my fresh eyes).

I was able to get the orientation horizontal and display the 4 menu items (Home, Personal, Center Operations, and Admin) by simply adjusting the StaticDisplayLevels to 2.

Interestingly I had a difficult time with this because I was using IE8. If I hadn't remembered an article I read awhile back about the menu and treeview controls not working properly with IE8 I would have been totally stumped. I had to put IE8 into compatibility mode to show the menu's (there is another fix as well, but this was quickest). I then added the meta tag to force compatibility in case you run into the same issue.

I'll just post my code as is and see if that gets you anywhere...
****ASPX PAGE****
<!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">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
	<asp:SiteMapPath ID="SiteMapPath1" runat="server"></asp:SiteMapPath>
	<asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1" Orientation="Horizontal" StaticDisplayLevels="2"></asp:Menu>
	
	<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
 
    </form>
</body>
</html>
 
 
***Web.sitemap***
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
  <siteMapNode title="Home" description="Home" url="~/home.aspx">
    <siteMapNode title="Personnel" description="Personnel!" url="~/PersMain.aspx">
      <siteMapNode title="Hiring" description="Hiring!" url="~/ActvsHrngList.aspx" />
      <siteMapNode title="Training" description="Training!" url="~/ActvsTrngList.aspx" />
      <siteMapNode title="Certifications" description="Cert's!" url="~/ActvsCertsList.aspx" />
      <siteMapNode title="Personnel" description="Personnel Info Maintenance" url="~/PersList.aspx" />
    </siteMapNode>
    <siteMapNode title="Center Operations" description="Center Operations!" url="~/SitesMain.aspx">
      <siteMapNode title="Permits" description="Permits!" url="~/ActvsPrmtsList.aspx" />
      <siteMapNode title="Safety" description="Safety!" url="~/ActvsSftyList.aspx" />
      <siteMapNode title="Maint and Repairs" description="MnR!" url="~/ActvsMnRList.aspx" />
      <siteMapNode title="Centers" description="Center Info Maintenance" url="~/SitesList.aspx" />
    </siteMapNode>
    <siteMapNode title="Admin" description="System Administration" url="~/AdmnMain.aspx">
      <siteMapNode title="Users" description="User Info Maintenance" url="~/UsersList.aspx" />
      <siteMapNode title="Lookups" description="Lookups Maintenance" url="~/LkupsList.aspx" />
    </siteMapNode>
  </siteMapNode>
</siteMap>

Open in new window

sample.jpg
0
 

Author Closing Comment

by:mlagrange
ID: 31598534
That's it! Thanks very much.

I guess it's good that MS keeps everything in a constant state of flux; otherwise, we might be able to settle down and crank things out...
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question