Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 9th, 2006, 11:21 AM
Authorized User
Points: 333, Level: 6
Points: 333, Level: 6 Points: 333, Level: 6 Points: 333, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2005
Location: Fresno, California, USA.
Posts: 94
Thanks: 0
Thanked 0 Times in 0 Posts
Default SiteMap Navigation question

Hey all,

I have a doosie that may have been answered throug hthe forums already but I searched and didn't find it so here is the question. I have a sitemap but I only want 1 layer displayed, how would I do that. To explain clearly, I have the default node that you must have that encapsulates subnodes for the site map so it is like:

<main node>
     <sub node1 />
     <sub node2 />
</main node>

Suppose I want to only display what is encapsulated in main node without having to display may node or have the user drill down through main node so the menu will read on default subnode1, subnode2? To expand further. What if I want to made different sites under subnode1 or 2 and only want to use those nodes as name spaces so i can keep track of my sites so if I want a menu on 1 page to only display what is under sub node 1 without displaying sub node 1 or only want to display what is under subnode 2 without display the main node name subnode 2? I hope that came out clear.

  #2 (permalink)  
Old August 22nd, 2006, 05:29 PM
Authorized User
Points: 333, Level: 6
Points: 333, Level: 6 Points: 333, Level: 6 Points: 333, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2005
Location: Fresno, California, USA.
Posts: 94
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Someone has to know the answer to this. I am just trying to get my menus to only show what is underneath a certain node so I may have multiple menus using different parts of my sitemap.

  #3 (permalink)  
Old August 24th, 2006, 11:05 PM
Friend of Wrox
 
Join Date: Feb 2006
Location: , , USA.
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If I understand your asking correctly, then all you need to do is configure the control you are using to display the sitemap data. There are lots of controls you can bind the web.sitemap to.

Here is a treeview menu bound to my web.sitemap that doesn't show the parent node, but only each node underneath it:

Code:
    <asp:TreeView runat="server" 
        ID="trVwForensics" 
        CssClass="subMenuArea" 
        DataSourceID="SiteMapDataSource1" 
        ShowExpandCollapse="false" 
        NodeIndent="15" 
        ExpandDepth="2"
        LeafNodeStyle-VerticalPadding="4" 
        MaxDataBindDepth="-1"   
        PopulateNodesFromClient="false" />
    <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" 
        StartFromCurrentNode="false" 
        ShowStartingNode="false"  
        StartingNodeUrl="../Forensics/Default.aspx" />
They key is to set the starting node Url, and then set ShowStartingNode="false". If you don't set the starting Url, it will default to the root node.

Hope that helps.

Neil

Neil Timmerman
Programmer
Veris Consulting
  #4 (permalink)  
Old August 24th, 2006, 11:12 PM
Friend of Wrox
 
Join Date: Feb 2006
Location: , , USA.
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oh and if you only want to show one level, meaning only the level below the node you set as your start node in the sitemapdatasource, you need to set the MaxDataBindDepth="0" in the treeview or whatever control you decide to use.

It seems kind of funny that setting it to zero shows one level. Intuition is that the value one would show one level and so on and so forth. I guess the logic to that was probably that, you must want to show at least one level or you wouldn't be using one of these hierachical controls. So zero defaults to one level, MaxDataBindDepth="1" gives you two levels and so on.

Neil Timmerman
Programmer
Veris Consulting
  #5 (permalink)  
Old August 26th, 2006, 10:33 AM
Authorized User
Points: 333, Level: 6
Points: 333, Level: 6 Points: 333, Level: 6 Points: 333, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2005
Location: Fresno, California, USA.
Posts: 94
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you. I have been looking for this answer for awhile hehe.

  #6 (permalink)  
Old August 30th, 2006, 12:44 AM
Friend of Wrox
 
Join Date: Feb 2006
Location: , , USA.
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Glad I could help.

It also helps to just start trying things. Just plug in different values to the methods and properties you suspect might have something to do with what you are trying to do. You'll get lucky sometimes and figure it out. That, and hit the MSDN libraries. They usually are worthless but you can get some hints of what to google for there.

Sometimes class methods and object hierarchies don't make much sense because the people who design them are too smart for their own good (a.k.a. have no common sense).

I often wonder who really is more clever: the people who write the .net framework, or the poor saps who have to pour through the piss poor MSDN library docs to figure out how their crap works. I'm only half way serious. I'll take .net anyday over coding in classic asp. But sometimes I wonder...

Neil Timmerman
Programmer
Veris Consulting
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sitemap melania ASP.NET 3.5 Basics 0 October 27th, 2008 01:20 PM
web.sitemap workidoo BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 June 13th, 2008 08:42 AM
SiteMap Problems kdehl113 ASP.NET 2.0 Basics 2 September 5th, 2006 12:31 AM
sitemap and navigation help -Dman100- ASP.NET 2.0 Basics 0 July 17th, 2006 10:28 PM
chapter 3 sitemap try it out diango BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 January 16th, 2006 11:40 AM



All times are GMT -4. The time now is 08:48 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.