Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
|
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion 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 April 10th, 2011, 08:44 AM
Authorized User
 
Join Date: Jan 2011
Posts: 89
Thanks: 1
Thanked 0 Times in 0 Posts
Default Different items in WebSiteMap and Menu

Am I right in saying you can only have one Web.sitemap? I have an issue where I have all pages for the WebSiteMap but dont want them all included in the menu, whats the best way to dis-include some items from the menu?
 
Old April 10th, 2011, 08:48 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
Am I right in saying you can only have one Web.sitemap?
Nope, you can have multiple site maps but you need to register them:

http://msdn.microsoft.com/en-us/library/ms178426.aspx

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old April 10th, 2011, 04:35 PM
Authorized User
 
Join Date: Jan 2011
Posts: 89
Thanks: 1
Thanked 0 Times in 0 Posts
Default

I created two sitemap files: SiteMapPath.sitemap and Menu.sitemap, I added them as described in web.config:

<siteMap defaultProvider="SiteMapPath">
<providers>
<add name="SiteMapPath" type="System.Web.XmlSiteMapProvider" siteMapFile="~/SiteMapPath.sitemap"/>
<add name="Menu" type="System.Web.XmlSiteMapProvider" siteMapFile="~/Menu.sitemap"/>
</providers>
</siteMap>

- and set SiteMapProvider="SiteMapPath" for the SiteMapPath control which is fine but there is no SiteMapProvider attribute for the Menu control so I'm unable to assing the menu to its own site map file??
 
Old April 11th, 2011, 03:01 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Alex,

A Menu has a DataSourceID property which can refer to a SiteMapDataSoource control in your page. The SiteMapDataSource control (from the Data category of the Toolbox) then has a SiteMapProvider property.

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old April 11th, 2011, 06:23 AM
Authorized User
 
Join Date: Jan 2011
Posts: 89
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi Imar,

For the menu I set DataSourceID="MenuSiteMapDataSource", which is the ID of the SiteMapDataSource control which in turn has SiteMapProvider="MenuSiteMap".

In Web.config I have:

<siteMap defaultProvider="MenuSiteMap">
<providers>
<add name="MenuSiteMap" type="System.Web.SiteMapProvider" siteMapFile="~/Menu.sitemap" />
<add name="SMPSiteMap" type="System.Web.SiteMapProvider" siteMapFile="~/SiteMapPath.sitemap" />
</providers>
</siteMap>

- but I keep getting errors saying: Cannot create an abstract class - against the type attribute??
 
Old April 11th, 2011, 07:56 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Alex,

System.Web.SiteMapProvider is indeed an abstract class. So, you need to register one of its concrete descendents instead. In an earlier post you used the System.Web.XmlSiteMapProvider which is the correct type.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old April 11th, 2011, 12:26 PM
Authorized User
 
Join Date: Jan 2011
Posts: 89
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks for the help again Imar, I couldnt find where to explicitly set the SiteMapPath's SiteMapDataSource control (like with DataSourceID in the menu) so I set this one as the defaultProvider so it picked it up.





Similar Threads
Thread Thread Starter Forum Replies Last Post
I can't add space between the items of the menu skiabox BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 7 June 2nd, 2010 03:35 PM
Blank items in menu ricardor ASP.NET 2.0 Basics 2 December 18th, 2009 06:08 AM
CH 15 Context Menu - Element Menu Items Razzy The Pug BOOK: Ivor Horton's Beginning Visual C++ 2005 2 November 9th, 2008 03:53 PM
Adding Menu Items using VB SamuelP ASP.NET 2.0 Professional 0 October 23rd, 2006 08:01 AM
Menu Items JoBi C# 0 October 20th, 2004 08:51 PM





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