Results 1 to 12 of 12

Thread: Menu control won't display horizontal

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2004
    Posts
    541

    Menu control won't display horizontal

    Hi all,

    Had two questions about the ASP.NET menu control.

    1) I have a menu control which is using a SiteMapDataSource. This is bound to a .sitemap file. I have the orientation property set to horizontal, but for some strange reason it still displays vertical. I can't for the life of me figure out why it's doing this. Am I doing something wrong here?

    2) Is there a way to not display the root (Home) directory on my menu control? I only want to show Customer Support, Technician Support, Administration, and Site Map on the control.

    Code:
    <?xml version="1.0" encoding="utf-8" ?>
    <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
        
        <siteMapNode url="Default.aspx" title="Home"  description="Home page">
            
            <siteMapNode url="CustomerSupport.aspx" title="Customer Support"  description="">
              <siteMapNode url="ProductRegistration.aspx" title="Register products"  description="" />
              <siteMapNode url="CustomerSurvey.aspx" title="Complete customer survey"  description="" />
              <siteMapNode url="ContactUs.aspx" title="Contact Us"  description="" />
            </siteMapNode>
    
            <siteMapNode url="TechnicianSupport.aspx" title="Technician Support"  description="">
              <siteMapNode url="CustomerIncidentDisplay.aspx" title="Display customer incidents"  description="" />
              <siteMapNode url="IncidentUpdate.aspx" title="Update incidents"  description="" />
            </siteMapNode>
    
            <siteMapNode url="Administration.aspx" title="Administration"  description="">
              <siteMapNode url="ProductMaintenance.aspx" title="Maintain products"  description="" />
              <siteMapNode url="CustomerMaintenance.aspx" title="Maintain customers"  description="" />
              <siteMapNode url="TechnicianMaintenance.aspx" title="Maintain technicians"  description="" />
              <siteMapNode url="IncidentCreation.aspx" title="Create incidents"  description="" />
              <siteMapNode url="TechnicianIncidentSummary.aspx" title="Display technician incidents"  description="" />
              <siteMapNode url="IncidentAssignment.aspx" title="Assign incidents"  description="" />
              <siteMapNode url="IncidentDisplay.aspx" title="Display incidents"  description="" />
              <siteMapNode url="CustomerDisplay.aspx" title="Display customers"  description="" />
            </siteMapNode>
          
            <siteMapNode url="Map.aspx" title="Site Map"  description="" />
              
      </siteMapNode>
      
    </siteMap>
    Thanks,

    Strick

  2. #2
    Frenzied Member brin351's Avatar
    Join Date
    Mar 2007
    Location
    Land Down Under
    Posts
    1,293

    Re: Menu control won't display horizontal

    Probably because you have the Home node as the parient to all other siteMape nodes. Try moving the closing tage for home node directly after it's opening tag, you'll then have 5 nodes at the same level and they should be the menu heads.

    I have not used the siteMap/menu in production so there may be a way to declare which nodes to use from the datasource on the sitemap tag. If not use the dataBound event and do something like

    if e.node.title = "Home" then e.visible = false
    The problem with computers is their nature is pure logic. Just once I'd like my computer to do something deluded.

  3. #3
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: Menu control won't display horizontal

    Quote Originally Posted by stricknyn View Post
    Hi all,

    Had two questions about the ASP.NET menu control.

    1) I have a menu control which is using a SiteMapDataSource. This is bound to a .sitemap file. I have the orientation property set to horizontal, but for some strange reason it still displays vertical. I can't for the life of me figure out why it's doing this. Am I doing something wrong here?
    hay,
    you need to show us the markup for the menu it self, not the xml file

    and what you mean about not displaying the Home, this node if not important then why you didn't remove it from the XML file
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  4. #4
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Menu control won't display horizontal

    Hey,

    With the Menu Control, in conjunction with the site map, you HAVE to have a root node. If you don't have to show it in the Menu control then set the ShowStartingNodeProperty of the SiteMapDataSouce:

    http://msdn.microsoft.com/en-us/libr...rtingnode.aspx

    Gary

  5. #5
    Frenzied Member brin351's Avatar
    Join Date
    Mar 2007
    Location
    Land Down Under
    Posts
    1,293

    Thumbs up Re: Menu control won't display horizontal

    Quote Originally Posted by gep13 View Post
    Hey,

    With the Menu Control, in conjunction with the site map, you HAVE to have a root node. If you don't have to show it in the Menu control then set the ShowStartingNodeProperty of the SiteMapDataSouce:

    http://msdn.microsoft.com/en-us/libr...rtingnode.aspx

    Gary
    That should teach me not to stab in the dark at questions I know little about. But then again .....
    The problem with computers is their nature is pure logic. Just once I'd like my computer to do something deluded.

  6. #6
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Menu control won't display horizontal

    Quote Originally Posted by brin351 View Post
    That should teach me not to stab in the dark at questions I know little about. But then again .....
    I do that all the time

  7. #7
    Junior Member
    Join Date
    Dec 2010
    Posts
    28

    Re: Menu control won't display horizontal

    Striknyn,

    To answer, "2) Is there a way to not display the root (Home) directory on my menu control? I only want to show Customer Support, Technician Support, Administration, and Site Map on the control."

    Yes, however, there will be a blank space displayed ... so ... put another blank space at the end to balance the line:

    Code:
    <?xml version="1.0" encoding="utf-8" ?>
    <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
        <siteMapNode url="" title=""  description="Home Page" >
            <siteMapNode url="" title="About CJA"  description="" >
                <siteMapNode url="~/1About/contact/contacts.pdf" title="Contacts"  description="" />
                <siteMapNode url="~/1About/location/default.aspx" title="Location"  description="" />
                <siteMapNode url="~/1About/director/default.aspx" title="Director"  description="" />
                <siteMapNode url="~/1About/history/default.aspx" title="History"  description="" />
            </siteMapNode>
            <siteMapNode url="" title="General Information"  description="" >
                <siteMapNode url="~/2Info/accountability/accountability1010.pdf" title="Accountability Report"  description="" />
                <siteMapNode url="~/2Info/foiact/default.aspx" title="Freedom of Information Act"  description="" />
                <siteMapNode url="~/2Info/training/Training-Act-as-of-12-11-08.pdf" title="SC Law Enforcement Training Act"  description="" />
            </siteMapNode>
            <siteMapNode url="" title="Training"  description="" >
                <siteMapNode url="~/3Train/catalog/cjacat2010-11.pdf" title="CJA Catalog"  description="" />
                <siteMapNode url="~/3Train/studio/default.aspx" title="CJA Studio Information"  description="" />
                <siteMapNode url="~/3Train/reserve/default.aspx" title="Reserve Officer"  description="" />
            </siteMapNode>
            <siteMapNode url="" title="Standards &amp; Testing"  description="" >
                <siteMapNode url="~/5Standards/standards/default.aspx" title="Standards"  description="" />
                <siteMapNode url="~/5Standards/testing/default.aspx" title="Testing"  description="" />
            </siteMapNode>
            <siteMapNode url="~/6Forms/default.aspx" title="Forms"  description="" />
            <siteMapNode url="~/7Lets/default.aspx" title="LETS"  description="" />
            <siteMapNode url="~/8News/Academy-Connection-Volume-2-Issue-4-10-5-10.pdf" title="News"  description="" />
            <siteMapNode url="~/9links/default.aspx" title="Links"  description="" />
            <siteMapNode url="" title=""  description="" />
        </siteMapNode>
    </siteMap>
    Last edited by gep13; Dec 9th, 2010 at 03:19 PM. Reason: Added Code Tags

  8. #8
    Junior Member
    Join Date
    Dec 2010
    Posts
    28

    Re: Menu control won't display horizontal

    Stricknyn,

    As to, "1) I have a menu control which is using a SiteMapDataSource. This is bound to a .sitemap file. I have the orientation property set to horizontal, but for some strange reason it still displays vertical. I can't for the life of me figure out why it's doing this. Am I doing something wrong here?"

    I'm having fits with the menu - VS 2008 w/ Framework v3.5 barely worked at all and VS 2010 w/ Framework v4.0 is being obdurate!

    A little help, please.

    VS2008 w/ Framework v3.5 did not render the asp:menu control at all well for me; could not change forecolor, underline attributes etc. to override the linked CSS file.

    Now I am using VS2010 w/ Framework v4.0 and a table layout. I am getting control of things like forecolor, underline attributes etc. but the entire menu will not center on the page, instead it is slammed left. The table is designed to center and the menu table row reads:

    Code:
    <tr id="hbot">
    	<td id="hblrail" style="text-align: left; width: 5&#37;; border: none; background-color: #022E54; visibility: visible">
    	     &nbsp;
    	</td>
        <td id="hmenu" align="center" style="text-align: center; width: 90%; height: 1%; border: none thin yellow; background-color: #2B4658; visibility: visible" colspan="4">
            <div style="text-align: center">
                <br/>
                <asp:Menu ID="Menu1" align="left" Orientation="Horizontal" runat="server" 
                    DataSourceID="SiteMapDataSource1" StaticDisplayLevels="2" BackColor="#3E647E" 
                    ForeColor="White" StaticMenuItemStyle-BackColor="#3E647E" 
                    DynamicMenuItemStyle-BackColor="#3E647E" Font-Size="Large" 
                    StaticEnableDefaultPopOutImage="false" Width="100%">
                </asp:Menu>
                <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
                <br/>
            </div>
        </td>
    	<td id="hbrrail" style="text-align: left; width: 5%; border: none; background-color: #022E54; visibility: visible">
    	     &nbsp;
    	</td>
    </tr>
    I'm stuck with either / or. Either I can have a centered horizontal menu (which is what is wanted) but with blue underlined links and no "container" formatting (not wanted) or I can have (the beginning of) formatted "containers" - looks like buttons - with white lettering, etc.
    BTW - align="center" in the asp:Menu would only stack the sub-menu items centered over each other not center the entire menu.



    -Thanks
    Last edited by gep13; Dec 9th, 2010 at 02:54 PM. Reason: Added code tags

  9. #9
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Menu control won't display horizontal

    Quote Originally Posted by tagtech View Post
    Striknyn,

    To answer, "2) Is there a way to not display the root (Home) directory on my menu control? I only want to show Customer Support, Technician Support, Administration, and Site Map on the control."

    Yes, however, there will be a blank space displayed ... so ... put another blank space at the end to balance the line:
    You don't need to do this.

    As I explained, you can do this through the ShowStartingNodeProperty.

    Gary

  10. #10
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Menu control won't display horizontal

    @tagtech,

    Welcome to the forums!!

    When posting into the forums, can you remember to use [CODE][/CODE] tags? This makes your post a lot easier to read.

    I have edited your above post to put code tags in place.

    Thanks

    Gary

  11. #11
    Junior Member
    Join Date
    Dec 2010
    Posts
    28

    Re: Menu control won't display horizontal

    Gep13,

    Excuse me. I saw, "you HAVE to have a root node" and quit reading. Mea culpa.

  12. #12
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Menu control won't display horizontal

    Quote Originally Posted by tagtech View Post
    Gep13,

    Excuse me. I saw, "you HAVE to have a root node" and quit reading. Mea culpa.
    Ah, I see.

    Not a problem at all.

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width