CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 4/8/2008 11:46:00 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 13 Views: 158 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
14 Items, 1 Pages 1 |< << Go >> >|
rabbit1986
Asp.Net User
Hide my first parent level in Navigation Menu4/8/2008 11:46:00 AM

0/0

 Hello,

 Here is my problem.

I have a parentNode in my web.siteMap, which only has a display function as rootnode for my SiteMapPath.

But this parentNode doesn't link to anywhere, so I do not want to see it on my navigation Menu. is there anyway to do this?

 
My siteMap looks like this:

 <siteMapNode url="" title="WAAK" description="">            ===> this is the one I would like to display in my siteMapPath ( only for the visual aspect, so that my sitemappath has a starting node ) AND NOT in the Menu.
    <siteMapNode type="hoofd" url="troeven.aspx" title="Onze troeven" description=""/>

 

.... 

</<siteMapNode>
 

My Menu and siteMapPath look like this ( it's the circled item I want to be invisile or removed, the siteMap still needs the item " Waak" )

 

 

 

Thanks in advance

Hope you understand this strange question. 

Suprotim Agarwa
Asp.Net User
Re: Hide my first parent level in Navigation Menu4/8/2008 12:33:09 PM

0/0

http://www.wintellect.com/cs/blogs/jprosise/archive/2006/06/22/hiding-the-root-node-from-sitemappath.aspx

 

HTH,
Suprotim Agarwal


Some Top Must-Have Tools for an ASP.NET Developer

Click "Mark as Answer" on the post that helped you. This will help readers to know which post solved your issue
ar_amit1985
Asp.Net User
Re: Hide my first parent level in Navigation Menu4/8/2008 12:39:37 PM

0/0

 hi

    if you are binding your control with sitemapdatasource then you have to modify the sitemapdatasource control with this

    <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="False" SiteMapProvider="default" /> 

    add  following property to sitemapdatasource

        ShowStartingNode="False"

    thats working for me

 

Please Mark as Answer is post helped you 


thanks n Regards
Amit
rabbit1986
Asp.Net User
Re: Hide my first parent level in Navigation Menu4/8/2008 1:55:58 PM

0/0

 It"s just the opposite I want.

 The starting node must be shown on the SiteMapPath, but NOT on the NavMenu.
 

rabbit1986
Asp.Net User
Re: Hide my first parent level in Navigation Menu4/8/2008 1:57:04 PM

0/0

 This doesn't work for me.

As I have subitems onder certain navigationItems, your code shows all my subItems next to eacht other, resulting in a long horizontal navigationMenu.

 

Amanda Wang - M
Asp.Net User
Re: Hide my first parent level in Navigation Menu4/10/2008 4:12:01 AM

0/0

Hi,

You can try to remove the rootnode of the menuitems like this, but it will stay on the sitemappath,

protected void Menu1_DataBound(object sender, EventArgs e)
    {
        //get the childnodes of the rootnode
        MenuItemCollection mic = this.Menu1.Items[0].ChildItems;
        //clear the items of the menu
        this.Menu1.Items.Clear();
        // add the items for the menu control
        for (int i = 0; i < mic.Count;i++ )
        {
            MenuItem mi = mic[i];
            this.Menu1.Items.Add(mi);
        }
    }

Hope it helps.


Please remember to mark the replies as answers if they help and unmark them if they provide no help.


Yours sincerely,
Amanda Wang
Microsoft Online Community Support
rabbit1986
Asp.Net User
Re: Hide my first parent level in Navigation Menu4/10/2008 8:13:21 AM

0/0

 Thanks for the answer.

The code seems really logical and working, but the problem is that the first line of code does actually detect my rootnode, but the collection of childnodes is empty, the number is 0.

 Here is screenshot of my siteMap.

 

 

Amanda Wang - M
Asp.Net User
Re: Hide my first parent level in Navigation Menu4/10/2008 9:09:48 AM

0/0

Hi,

You paste your sitemap as a image, so I cannot use it to have a test, I will post my test code entirely.

1. The sitemap:

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
    <siteMapNode title="Parts" url="~/Parts/Default.aspx">
    <siteMapNode title="Part List" url="~/Menu/Cases/Cases/remove/Default.aspx" />
    <siteMapNode visible="false" title="Part Details" url="~/Parts/PartDetails.aspx"/>
    <siteMapNode title="Search Parts" url="~/Parts/PartSearch.aspx"/>
  </siteMapNode>

</siteMap>

2. The mene code:

 <asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1" CssClass="menu"
                        BackColor="#FFFBD6" DynamicHorizontalOffset="2"
        Font-Names="Verdana" Font-Size="12px"
                        ForeColor="#990000" StaticSubMenuIndent="10px" 
        ondatabound="Menu1_DataBound" >
                    </asp:Menu> 

    <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />

    <asp:SiteMapPath ID="SiteMapPath1" runat="server">
    </asp:SiteMapPath>

3. The codebehind:

protected void Menu1_DataBound(object sender, EventArgs e)
    {
        //get the childnodes of the rootnode
        MenuItemCollection mic = this.Menu1.Items[0].ChildItems;
        //clear the items of the menu
        this.Menu1.Items.Clear();
        // add the items for the menu control
        for (int i = 0; i < mic.Count;i++ )
        {
            MenuItem mi = mic[i];
            this.Menu1.Items.Add(mi);
        }
    }

So you can create a new application to have a test by using above code. If your problem cannot be solved, you can post the details of your code, so we can use it to repro your problem on our local, which is helpful.


Please remember to mark the replies as answers if they help and unmark them if they provide no help.


Yours sincerely,
Amanda Wang
Microsoft Online Community Support
rabbit1986
Asp.Net User
Re: Hide my first parent level in Navigation Menu4/10/2008 11:24:58 AM

0/0

 Hay,

 your code seems to work perfectly ... mine doesn't

here is my sitemap:

<?xml version="1.0" encoding="utf-8"?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
  <siteMapNode url="" title="WAAK" description="">
    <siteMapNode type="hoofd" url="Default.aspx?ID=25" title="Wie zijn wij" description="">
      <siteMapNode url="Default.aspx?ID=26" title="Bedrading en bekabeling" description="" />
      <siteMapNode url="Default.aspx?ID=27" title="Waak Metaal" description="Waak Metaal" xmlns="">
        <siteMapNode url="Default.aspx?ID=28" title="Plaatbewerking" description="" />
        <siteMapNode url="Default.aspx?ID=29" title="Buis- en profielbewerkingen" description="" />
      </siteMapNode>
    </siteMapNode>
    <siteMapNode type="hoofd" url="troeven.aspx" title="Onze troeven" description="">
    </siteMapNode>
    <siteMapNode type="hoofd" url="Bedrijfsinfo.aspx" title="Bedrijfsinfo" description="">
      <siteMapNode url="Doelstelling.aspx" title="Doelstelling" description="" />
      <siteMapNode url="Visie_waarden.aspx" title="Visie en waarden" description="" />
      <siteMapNode url="Waak_toen_nu.aspx" title="Waak toen en nu" description="" />
      <siteMapNode url="Waak_cijfers.aspx" title="Waak in cijfers" description="" />
    </siteMapNode>
    <siteMapNode type="hoofd" url="Nieuws.aspx" title="Nieuws" description="">
    </siteMapNode>
    <siteMapNode type="hoofd" url="" title="Vacatures" description="">
      <siteMapNode url="TewerkstellingsVoorwaarden.aspx" title="Tewerkstellingsvoorwaarden" description="" />
      <siteMapNode url="WatBiedenWij.aspx" title="Wat bieden wij" description="" />
      <siteMapNode url="Vacatures.aspx" title="Vacatures" description="" />
    </siteMapNode>
    <siteMapNode type="hoofd" url="Links.aspx" title="Links" description="">
    </siteMapNode>
    <siteMapNode type="hoofd" url="Contact.aspx" title="Contact" description="">
    </siteMapNode>
  </siteMapNode>
</siteMap>
 

 My Code:

<asp:SiteMapPath CssClass="sitemapPath" ParentLevelsDisplayed="4" ID="SiteMapPath1"
                    runat="server" RootNodeStyle-Font-Bold="True" Font-Names="Verdana"
                    Font-Size="0.8em" PathSeparator=" : " >
                    <PathSeparatorStyle Font-Bold="True" ForeColor="#1C5E55" />
                    <CurrentNodeStyle ForeColor="#333333" />
                    <NodeStyle Font-Bold="True" ForeColor="#666666" />
<RootNodeStyle Font-Bold="True" ForeColor="#000099" Font-Size="Small"></RootNodeStyle>
                    </asp:SiteMapPath>

 

 <asp:Menu  StaticDisplayLevels="2" MaximumDynamicDisplayLevels="1" 
                    StaticEnableDefaultPopOutImage="false" ID="Menu1"
                    runat="server" DataSourceID="SiteMapDataSource1" Orientation="Horizontal"
                    StaticMenuStyle-CssClass="navigatieBalk" StaticSelectedStyle-ForeColor="Silver"
                    DynamicEnableDefaultPopOutImage="False"
                    onmenuitemdatabound="Menu1_MenuItemDataBound">
                    <StaticMenuStyle VerticalPadding="" />
                    <StaticMenuItemStyle Font-Bold="True"  VerticalPadding="9" Font-Overline="False" Font-Size="Small"
                        ForeColor="White" />
                    <DynamicMenuStyle CssClass="dynmenu"/>
                    <DynamicMenuItemStyle BackColor="#003399"  ForeColor="White" HorizontalPadding="5" />
                </asp:Menu>

 

Hope this helps a bit!

 

Thank you already for helping me this much. 

 

Amanda Wang - M
Asp.Net User
Re: Hide my first parent level in Navigation Menu4/10/2008 11:39:23 AM

0/0

Hi rabbit1986 ,

You should place the code in the menu control's DataBound event, but not MenuItemDataBound event:

The menu should not be like this:

rabbit1986:
<asp:Menu  StaticDisplayLevels="2" MaximumDynamicDisplayLevels="1" 
                    StaticEnableDefaultPopOutImage="false" ID="Menu1"
                    runat="server" DataSourceID="SiteMapDataSource1" Orientation="Horizontal"
                    StaticMenuStyle-CssClass="navigatieBalk" StaticSelectedStyle-ForeColor="Silver"
                    DynamicEnableDefaultPopOutImage="False"
                    onmenuitemdatabound="Menu1_MenuItemDataBound">

BUT SHOULD LIKE THIS:

"]<asp:Menu  StaticDisplayLevels="2" MaximumDynamicDisplayLevels="1" 
                    StaticEnableDefaultPopOutImage="false" ID="Menu1"
                    runat="server" DataSourceID="SiteMapDataSource1" Orientation="Horizontal"
                    StaticMenuStyle-CssClass="navigatieBalk" StaticSelectedStyle-ForeColor="Silver"
                    DynamicEnableDefaultPopOutImage="False"
                    ondatabound="Menu1_DataBound">

The codebehind should be:
 protected void Menu1_DataBound(object sender, EventArgs e)
    {
        //get the childnodes of the rootnode
        MenuItemCollection mic = this.Menu1.Items[0].ChildItems;
        //clear the items of the menu
        this.Menu1.Items.Clear();
        // add the items for the menu control
        for (int i = 0; i < mic.Count;i++ )
        {
            MenuItem mi = mic[i];
            this.Menu1.Items.Add(mi);
        }

After add the menu databound event by using your code, the menu can work fine.

Hope it helps.
    }

 


Please remember to mark the replies as answers if they help and unmark them if they provide no help.


Yours sincerely,
Amanda Wang
Microsoft Online Community Support
rabbit1986
Asp.Net User
Re: Hide my first parent level in Navigation Menu4/10/2008 12:30:53 PM

0/0

 OMG, I'm so ashamed, that I looked over that stupid mistake.

I have been looking through your code, without finding the difference with mine.

 

Thank you.

 Now there's one problem left: my items are now one long row of items, there's no more distinction between mainItems and subItems, I have no more Dynamic Items. It's one long row ( this seems quite logic to me, as I simply added them to the menuItemCollection )

Is there a way to fix this? 

Amanda Wang - M
Asp.Net User
Re: Hide my first parent level in Navigation Menu4/11/2008 2:19:10 AM

0/0

Hi,

rabbit1986:

 Now there's one problem left: my items are now one long row of items, there's no more distinction between mainItems and subItems, I have no more Dynamic Items. It's one long row ( this seems quite logic to me, as I simply added them to the menuItemCollection )

Is there a way to fix this? 

Sorry, it is seemly that we cannot understand your problem very clearly, Could you please give for details about it?


Please remember to mark the replies as answers if they help and unmark them if they provide no help.


Yours sincerely,
Amanda Wang
Microsoft Online Community Support
rabbit1986
Asp.Net User
Re: Hide my first parent level in Navigation Menu4/14/2008 6:04:58 AM

0/0

 I'm sorry.

 

The problem is that all of my items are now on the same level. Even the subitems are now displayed next to their parent, on the same level. All of my parent-child-structure seems to be gone ...

here's a picture:

 

 Thanks in advance.
 

Amanda Wang - M
Asp.Net User
Re: Hide my first parent level in Navigation Menu4/14/2008 6:10:17 AM

0/0

Hi,

From you code, we can see:

rabbit1986:
<asp:Menu  StaticDisplayLevels="2" MaximumDynamicDisplayLevels="1" 
                    StaticEnableDefaultPopOutImage="false" ID="Menu1"
                    runat="server" DataSourceID="SiteMapDataSource1" Orientation="Horizontal"
                    StaticMenuStyle-CssClass="navigatieBalk" StaticSelectedStyle-ForeColor="Silver"
                    DynamicEnableDefaultPopOutImage="False"
                    onmenuitemdatabound="Menu1_MenuItemDataBound">

You set the menu's StaticDisplayLevels attribute is 2,  try to remove  StaticDisplayLevels="2" from the menucontrol, you will have the parent-child structure.

Hope it helps.


Please remember to mark the replies as answers if they help and unmark them if they provide no help.


Yours sincerely,
Amanda Wang
Microsoft Online Community Support
14 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:

Web:
Hide my first parent level in Navigation Menu - ASP.NET Forums Re: Hide my first parent level in Navigation Menu. 04-08-2008, 8:33 AM. Contact ... Re: Hide my first parent level in Navigation Menu ...
CMS Made Simple Forum: creating menu with 4 levels active parent, that is the first-level parent of a child page that is the .... The menu is using the Simple Navigation menu template." ...
DHTML Lab: Hierarchical Menus, I; Menu Hiding - webreference.com It may happen, so we hide this child menu first. ... It hides all parent menus except for the top level menu. The top level menu is assigned to the local ...
Customize site navigation - Windows SharePoint Services ... The top link bar cannot be customized at this level without first breaking the inheritance from the parent site. Inherited not included parent The site uses ...
Hide an item in navigation using Navigation Manager? - RedDot CMS ... hide all subpages first before you can hide the parent page. You don't see the subpages any longer in the Navigation Manager. ...
The JavaScript Source: Navigation : VB Menu InitMouseHandlers(); } } // places the first level boxes on the screen at the tags ..... Website URL: http://javascriptsource.com/navigation/vb-menu.html ...
Reordering navigation menu? - Wetpaint Central At the moment, as far as I can tell, each level of the navigation menu has .... Yup having just begun my site that was the first change I'd like to be able ...
Creating a Dynamic Navigation Menu « Andy Peatling on WordPress Is there a way to close second level menus when a sibling is clicked? So, in you example, if I first clicked “United Kingdom” then clicked “Spain” the ...
Interface | matters: It's Got Layers...Cascading Menus In The ... Aug 7, 2006 ... For example, the hide-when formula on the first-level layer for HR reads ... In my first example, all of the menu labels are just text, ...
SharePoint 2007 navigation dissected – part 1 - Serge van den ... Global Navigation: Use global navigation of the parent site or of this site. .... first Level menu). Under News Publications(second Level). Press releases ...




Search This Site:










help!webpartzone in gridview templatecolumn

business layer

prevent users from sharing passwords

a way to use an array on a select statement

web application projects - problems with page.title

manipulating text of a textbox

sql express

hiding borwser status bar

looking for recommendations for modules

file download

querystring params not being read by dnn

tree menu control event

user session timeout problem

access is denied on my own machine

new click tracking feature ?

custom control attributes in property box

problem losing toplevel tabs in child portal - only me?

rich text -- is it safe?

help needed!

main entry point in vb.net.for startup object property

publishing multiple sites to internet

treeview on masterpage - onadaptedselectednodechanged doesn't fire

.net passport

help please i cant get rid of this error!!!

sql connection error

dnn 3.0.10 validators don't work right

remoting systems

what are reporting options for dnn.

postback operation on modal window.

dnn and ms cms?

 
All Times Are GMT