CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 1/4/2007 4:14:58 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 5 Views: 26 Favorited: 0 Favorite
6 Items, 1 Pages 1 |< << Go >> >|
Mainship
Asp.Net User
How do I use a sitemap to populate multiple menus?1/4/2007 4:14:58 PM

0

I'm rewriting a classic ASP site in ASP.NET 2.0.  I'm trying to determine if I'll use a sitemap for the menus or not.  I'll use one for other purposes:  I have a "You are on" area where I display the current page name.  I get it from the sitemap.  I also have a javascript function to bookmark the page - this is on the master page, and is one of the bottom menu options.  I need to pass it the title and URL of the page to be bookmarked.  I currently have it in a content control that I override in each of the content pages, but I'd much rather grab the data from the sitemap.  It seems silly to have something on the master page that is overwritten by every content page.  When I try to use the sitemap data, say with <%= SiteMap.CurrentNode.Title %>, I don't get the title in the bookmark, I get "%= SiteMap.CurrentNode.Title %, ".  BTW if anyone has a better way to bookmark the page, please let me know.  Googleing bookmark returns lots of sites with bookmark buttons or links, not sites explaining how to do it.

The default page and the homepage (these are two different pages) have a menu at the bottom, call it menu-1.  The default and home pages are the only two pages that contain menu-1.  I think this menu should be on these two content pages?

I have a menu across the top of every page, and a menu along the bottom.  These are in the Master page.  I also have a few directory pages that contain rows of links to other pages in the site, making each of these effectively menus.  Should I treat the directory pages as menus and use the sitemap to populate these menus?  Can I do all this with one sitemap?  How?

This is my first ASP.NET project, so be gentle, and explain in baby steps please!

 TIA, Diane

 

Leijun Jie - MS
Asp.Net User
Re: How do I use a sitemap to populate multiple menus?1/15/2007 3:40:43 AM

0

Hi Diane, maybe you can try to modify in-memory instance of SiteMapNode to construct different Menus, please take a look at:
How to: Programmatically Modify Site-Map Nodes in Memory

The future is now...
Sincerely,
LeiJun Jie
Microsoft Online Community Support
Dave Sussman
Asp.Net User
Re: How do I use a sitemap to populate multiple menus?1/15/2007 9:22:40 AM

0

You can do this with one or two sitemaps. If using one, then make sure your sitemap has a strict hierarchy, eg:

<siteMapNode>
  <siteMapNode url="Menu1.aspx">
    ... nodes for menu 1 ...
  </siteMapNode>
  <siteMapNode url="Menu2.aspx">
    ... nodes for menu 2 ...
  </siteMapNode>
</siteMapNode>

So you keep all of the nodes for the different menus separate, each under a root node of their own. Then at the top of the master page, for menu 1, you have:

<asp:SiteMapDataSource id="menu1Data" runat="server" StartingNodeUrl="Menu1.aspx" ShowStartingNode="false" />

and for the bottom menu you have:

<asp:SiteMapDataSource id="menu2Data" runat="server" StartingNodeUrl="Menu2.aspx" ShowStartingNode="false" />

Now the two menu controls (each bound to a differnt SiteMapDataSource) will only show the nodes starting from their menu. Make sense?

There is also nothing to stop you using multiple site map files, but I'm not sure that's necessary.

Dave

Mainship
Asp.Net User
Re: How do I use a sitemap to populate multiple menus?1/15/2007 4:42:07 PM

0

Thank you Dave.  I solved this, but in a different way.  I have a couple of menus off of the same page, so I added a querystring to make the url different. 

<siteMapNode url="default.aspx" title="Home" description="WriteAPrisoner.com">
    <siteMapNode url="homepage.aspx" title="HomePage" description="Home Page">
        <siteMapNode url="form-share-story.aspx" title="Share Your Success Story!" description="Success Story" />
        <siteMapNode url="subscribe.aspx" title="Join Our Email List!" description="Email List" />     
    </siteMapNode>
    <siteMapNode url="homepage.aspx?m=second" title="HomePage" description="Home Page">
        <siteMapNode url="inmateads.aspx" title="Inmate Ads" description="Inmate Ads">
            <siteMapNode url="allcustomers.aspx" title="Newest Members" description="Newest Members" />
            <siteMapNode url="statelistings.aspx" title="State Listings" description="State Listings" />
        </siteMapNode>
    </siteMapNode>
</siteMapNode>

I never thought of using different SiteMapDataSources.  That makes things much easier.

The other problem I have is a page can be on more than one menu.  Will using multiple SiteMapDataSources solve that?  At the moment, I'm using the site map for a 'You are on '  page name.  My menus are currently the same links I have for the Classic ASP version of the site.  This will at least work until I can get the menus working.

Diane

Dave Sussman
Asp.Net User
Re: How do I use a sitemap to populate multiple menus?1/15/2007 4:57:08 PM

0

Yep, query strings work just as well for splitting the menu up. Good idea.

The page being on more than one menu can become a problem if you want to highlight the trail, for example using a SiteMapPath. While you can also specify the provider in the SiteMapPath, you'd have to decide which provider to use, so ensure you get the right hierarchy. If you want to extract the title for a given node, then you can do this in code too, but again you'd have to specify the provider. Normally you'd do something like:

SiteMap.CurrentNode.Title

to get the title, but you'd have to specify the provider:

SiteMap.Providers["MyProvider"].CurrentNode.Title

So it's easy to do, you just have to be careful about where you get your data.

d

Mainship
Asp.Net User
Re: How do I use a sitemap to populate multiple menus?1/15/2007 5:33:13 PM

0

Sounds good.  Once I get some other issues worked out, I'll come back to the menus.  Thanks you.

Diane

6 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Core Internet Application Development with ASP.NET 2.0 Authors: Randy Connolly, Pages: 1049, Published: 2007
Pro C# 2008 and the .NET 3.5 Platform Authors: Andrew Troelsen, Pages: 1370, Published: 2007
Professional ASP.NET 2.0 Authors: Bill Evjen, Scott Hanselman, Farhan Muhammad, Srinivasa Sivakumar, Devin Rader, Pages: 1253, Published: 2005
Pro ASP.NET 2.0 in C# 2005 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1255, Published: 2005
Pro ASP.NET 2.0 in VB 2005: From Professional to Expert Authors: Laurence Moroney, Matthew MacDonald, Pages: 1253, Published: 2006
Using Microsoft FrontPage 2002 Authors: Neil Randall, Dennis Jones, Pages: 944, Published: 2001
ASP.NET 2.0: A Developer's Notebook Authors: Wei Meng Lee, Pages: 326, Published: 2005
ASP.NET 2.0 Black Book: black book Authors: Dreamtech Software, Dreamtech Software, Charul Shukla, Anil Kumar Barnwal, Dreamtech Software India, Pages: 1167, Published: 2006
Beginning ASP.NET 2.0 in C# 2005: From Novice to Professional Authors: Matthew MacDonald, Pages: 1148, Published: 2006
Pro ASP.NET 3.5 in C# 2008 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1498, Published: 2007

Web:
How to populate menus and sitemap(to display the path) dynamically ... How to populate menus and sitemap(to display the path) dynamically using multiple site map files. Last post 09-20-2006 8:57 AM by parepalli007. 0 replies . ...
CodeProject: Populating Menu Control in ASP.NET 2.0 - using ... An article on how to populate the Menu control in ASP. ... An easy use of owner drawn menu with variable styles like new Office products with titles, shading and icons. ... General, Can I have multiple sitemap File ? member ...
Using Multiple Sitemap Files in ASP.NET 2.0 (With Menu and ... If you wanna use multiple sitemap with SiteMapPath, you edit XmlDataSource GetMenuDataSource(SiteMapMenus menu,string serverMapPath) method like this : ...
[UDM] Search results SEARCH RESULTS 1 - 10 of 12 total results for populate ... or conversely use the link structure from a sitemap to populate the menus on other pages. ... Expanding menus. single nested level · multiple nested levels · in a frameset ...
ASP.NET 2.0 Data Access and Data-Binding You’ll also be shown you how to use the SiteMap class to set titles on your page ... It discusses how to populate multiple tables for use in a Disconnected ...
Working with ASP.NET site maps - Program - .Net - Builder AU However, like web.config files, a site may use multiple site map files. .... I currently use a sitemap to populate a menu on the left of my web page. ...
GNOME Applications menu: how to populate it? - LinuxQuestions.org If you have multiple users, you may need to transfer any personal ... I got the applications menu populated by installed a few apps (mainly ...
CodeProject: Using Multiple Sitemap Files in ASP.NET 2.0. Free ... Jan 10, 2006 ... An article on how to use mutliple sitemap files for your site navigation.; ... We now need a way to populate each of these navigation bars with the ... Using our new menu is now as easy as registering the user control on ...
how to populate multiple records in a mysql DB Post subject: Re: how to populate multiple records in a mysql DB Archived from groups: per prev. post (more info?) ...
Populate - Free DHTML JavaScript Web Menu Sample 58 Sitemap. Current Menu Version: 5.813 dated Saturday December 13 2008 ... Adding Multiple Menus to a Web Page · CSS Based Menus ... Dynamic Downloads are possible for the Populate demo; The code for this menu sample will be generated on ...












imagebutton problem!

asp.net 2.0's use of '/webresource.axd' with apache reverse proxy

how can i make autopostback to false of treeview in asp.net 2.0

opening a new window and resizing to image size

wrapping content into contentplaceholder of masterpage

one contentplaceholder shifting to the right when another displays an ascx file

accessing master page properties from a web form

treeview with anchor tags

html code?

submitting webform using master pages(asp.net 2.0)

creating my own hierachical data list without using the sitemapprovider class

error handling with master pages

asp:menu image backgrounds

attractive menu

inheritting from a masterpage class.

dropdowns used to filter a gridview are not working with the masterpage

populating a .net treeview control from a parent-child relationship db table

css not working upon debug

how to populate treeview control with this database schema?

accessing controls from the master page's code behind

how to dynamically load css style sheet ?

javascript with masterpage and content content

help : user master page with asp:formparameter , save only blank data to database msaccess

am i designing this right?

skin vs css

asp.panel height in a master page

how do you delete a node in a treeview????

google map

menu control posting back rather than navigating to a url

unable to view the sitemap ?

 
Search This Site:

 
  Privacy | Contact Us
All Times Are GMT