Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking 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 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 2nd, 2007, 03:44 PM
Registered User
 
Join Date: Jun 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Two separate menu from one sitemap?

I have a sitemap that sets the menu of one application which consists of twenty pages. Is there a simple way I could add in elements on the sitemap that would define the menu for a completely different collection of pages to be displayed in a whole new webform? Thanks!

                                                                                                    ~K

 
Old July 2nd, 2007, 03:57 PM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

Hi Kiesha!

I'm going through this right now with my own webhost. They're having some problems making it work, but I can post the sitemap section from my web.config file when I get home.

If you want the applications to be completely separate, there's no way to do that in one file. You can only have one master node. If it's ok that the applications share the root node of the sitemap then you can, but people could theoretically cross from one app to the other. If you really want them to be separate however, you have to define a second sitemap in your web.config. That's what I've tried to do. According to my webhost they can't figure out why it's not working, so we "think" my file is ok, but I thought I should warn you.

I'll post it when I get home. :)

-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
 
Old July 2nd, 2007, 04:01 PM
Registered User
 
Join Date: Jun 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks alot, i was just looking in the asp forum and I also founf this example which may be of some good use to both of us:
     http://forums.asp.net/p/1081356/1600129.aspx#1600129
   If you could also post your file whenever you get a chance that would be great! Thanks again!

 
Old July 2nd, 2007, 05:17 PM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

Hi!

:D That's it! I customized mine for my site, but this was the example code from the help files that I used.


     <providers>
       <add
         name="Company1SiteMap"
         type="System.Web.XmlSiteMapProvider"
         siteMapFile="~/Company1/Company1.sitemap" />
       <add
         name="Company2SiteMap"
         type="System.Web.XmlSiteMapProvider"
         siteMapFile="~/Company2/Company2.sitemap" />
     </providers>

Let me know if it works for you. I haven't heard anything from my webhost in several days. If it works for you, I'd like to harrass them again.

-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
 
Old July 3rd, 2007, 05:42 AM
Registered User
 
Join Date: Jun 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That's what I have in my web.config file, I was wondering how to I instantiate it to be displayed on a page. I have one up and running now but I'm not sure about the code used inside the page. Here is what my Web.config looks like:
Code:
   <siteMap>
      <providers>
        <add 
          name="WebSiteMap"
          type="System.Web.XmlSiteMapProvider" 
          siteMapFile="~/Web.sitemap" />
        <add 
          name="Web2SiteMap"
          type="System.Web.XmlSiteMapProvider" 
          siteMapFile="~/Web2.sitemap" />
      </providers>
    </siteMap>


    And here is what my datasource looks like in the first menu(the one that works)
                
Code:
 <asp:menu id="Menu"
Code:
                    datasourceid="SiteMapDataSource1"
                    disappearafter="500"
                    staticdisplaylevels="2"
                    staticsubmenuindent="20" 
                    orientation="Vertical"
                    font-names="Trebuchet MS, Arial" 
                    DynamicMenuItemStyle-Width="200"
                    Width="150"
                    runat="server">

                    <staticmenuitemstyle backcolor="RoyalBlue" forecolor="WhiteSmoke" horizontalpadding="5" verticalpadding="2" />
                    <statichoverstyle backcolor="CornflowerBlue" forecolor="White" borderstyle="Solid" borderwidth="1px" />
                    <dynamicmenuitemstyle backcolor="RoyalBlue" forecolor="WhiteSmoke" horizontalpadding="5" verticalpadding="2" />
                    <dynamichoverstyle backcolor="CornflowerBlue" forecolor="White" borderstyle="Solid" borderwidth="1px" />
                </asp:menu>


           with the asp datasource:
               
Code:
  <asp:sitemapdatasource id="SiteMapDataSource1" runat="server" />


            These last two sections I was wondering about. Can you show me an example of how you did this? Thanks a bunch :-)

 
Old July 4th, 2007, 01:31 AM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

Hi Keisha!

Everything looks fine to me with the web.config file. Are both sitemaps working or just one?

Here are a couple examples that I was able to get up and running. Only for the one site though, obviously. I used VWD Express. I like to bounce back and forth between source and design view but here's the code output.
Code:
        <asp:Menu ID="mnuMainMenu" runat="server" DataSourceID="smdsMySite">
        </asp:Menu>

        <asp:SiteMapDataSource ID="smdsMySite" runat="server" />
Everything else is beautification, this is the guts of what you really need. Obviously, it's a webform, so this all has to be inside form tags. But I just added a Site Map data source and gave it an ID. Then I added a menu control, gave it an id and told it the ID of the data source I'd created.

I also took advantage of design view to add some default formatting. As you can see the formatting adds a ton of weight to it. However, all I did to get it though was start with the controls above, click the expander arrow of the menu in design view, click the Auto Format link, and I chose the "Colorful" Scheme. VWD added all the code automatically.
Code:
        <asp:Menu ID="mnuMainMenu" runat="server" DataSourceID="smdsMySite" BackColor="#FFFBD6" DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#990000" StaticSubMenuIndent="10px">
            <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
            <DynamicHoverStyle BackColor="#990000" ForeColor="White" />
            <DynamicMenuStyle BackColor="#FFFBD6" />
            <StaticSelectedStyle BackColor="#FFCC66" />
            <DynamicSelectedStyle BackColor="#FFCC66" />
            <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
            <StaticHoverStyle BackColor="#990000" ForeColor="White" />
        </asp:Menu>

        <asp:SiteMapDataSource ID="smdsMySite" runat="server" />
I always find it amazing how much garbage this generates though. The HTML this outputs is over 200 lines long, with 20,000 characters topping out at 19K filesize. Pretty unbelievable.

-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Sitemap melania ASP.NET 3.5 Basics 0 October 27th, 2008 01:20 PM
SiteMap Problems kdehl113 ASP.NET 2.0 Basics 2 September 5th, 2006 12:31 AM
Web.Sitemap Tremmorkeep BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 July 21st, 2006 05:32 PM
Sitemap Problems mattid ASP.NET 2.0 Basics 1 May 29th, 2006 01:13 AM
sitemap generators zoltac007 ASP.NET 2.0 Basics 1 May 22nd, 2006 11:02 AM





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