Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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 October 9th, 2010, 07:13 PM
Registered User
 
Join Date: Oct 2010
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 7 menu control

I cannot seem to find what should be in the Web.config file in order for default.aspx to find "SiteMapDataSource1". Nor do I understand why 'SiteMapDataSource1' is not simply Web.sitemap.

<div id="MenuWrapper">
<asp:Menu ID="Menu1" runat="server" CssClass="MainMenu"
DataSourceID="SiteMapDataSource1" Orientation="Horizontal"
StaticEnableDefaultPopOutImage="False">
<StaticMenuItemStyle ItemSpacing="10px" />
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server"
SiteMapProvider="SiteMapDataSource1" />
</div>

There is no sitemap referenced in Web.config. I looked up some resources on how to link the Web.sitemap file, but am not even sure if I should have had to enter anything. I appreciate any help given, thanks.
 
Old October 9th, 2010, 08:32 PM
Registered User
 
Join Date: Oct 2010
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default web.config file

I should have posted this as well:

<system.web>
<siteMap defaultProvider="XmlSiteMapProvider">
<providers>
<add
name="Wrox"
type="System.Web.XmlSiteMapProvider"
siteMapFile="~/Web.sitemap" />

</providers>
</siteMap>
 
Old October 9th, 2010, 08:47 PM
Registered User
 
Join Date: Oct 2010
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default More...

When I use the web.config from the source files, I get the error that started me looking for solutions. The <system.web> section in your file has no reference to a sitemap file. The error:

The SiteMapProvider 'SiteMapDataSource1' cannot be found.
 
Old October 9th, 2010, 09:09 PM
Registered User
 
Join Date: Oct 2010
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Stack Trace

I have no idea why this web page footer reads .net 2.0, I am most definitely using .net 3.5...

Stack Trace:


[HttpException (0x80004005): The SiteMapProvider 'SiteMapDataSource1' cannot be found.]
System.Web.UI.WebControls.SiteMapDataSource.get_Pr ovider() +1208296
System.Web.UI.WebControls.SiteMapDataSource.GetHie rarchicalView(String viewPath) +15
System.Web.UI.HierarchicalDataSourceControl.System .Web.UI.IHierarchicalDataSource.GetHierarchicalVie w(String viewPath) +10
System.Web.UI.WebControls.HierarchicalDataBoundCon trol.GetData(String viewPath) +25
System.Web.UI.WebControls.Menu.DataBindItem(MenuIt em item) +56
System.Web.UI.WebControls.Menu.PerformDataBinding( ) +50
System.Web.UI.WebControls.HierarchicalDataBoundCon trol.PerformSelect() +85
System.Web.UI.WebControls.BaseDataBoundControl.Dat aBind() +73
System.Web.UI.WebControls.Menu.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.Ens ureDataBound() +82
System.Web.UI.WebControls.Menu.EnsureDataBound() +40
System.Web.UI.WebControls.BaseDataBoundControl.OnP reRender(EventArgs e) +22
System.Web.UI.WebControls.Menu.OnPreRender(EventAr gs e, Boolean registerScript) +15
System.Web.UI.WebControls.Menu.OnPreRender(EventAr gs e) +25
System.Web.UI.Control.PreRenderRecursiveInternal() +80
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.4952; ASP.NET Version:2.0.50727.4955
 
Old October 10th, 2010, 12:14 AM
Registered User
 
Join Date: Oct 2010
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Programming tools versions

Microsoft Visual Studio 2008
Version 9.0.30729.4462 QFE
Microsoft .NET Framework
Version 3.5 SP1
 
Old October 10th, 2010, 02:59 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You somehow tried to link the SiteMapDataSource back to itself:

Code:
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" 
SiteMapProvider="SiteMapDataSource1" />
The bold part shouldn't be there. In the book, the code looks like this:

Code:
 
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" 
          ShowStartingNode="False" />
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 October 10th, 2010, 06:02 PM
Registered User
 
Join Date: Oct 2010
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you, that did the trick





Similar Threads
Thread Thread Starter Forum Replies Last Post
Menu control kiwibrit BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 11 November 30th, 2009 04:11 PM
chapter 7 (menu control) rock1233 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 6 September 19th, 2009 02:44 PM
Chapter 7: Navigation - Menu Control VeganMan BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 12 April 10th, 2008 08:28 AM
Chapter 3 Menu Control ybai BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 June 30th, 2006 02:38 AM
menu control annieapple VS.NET 2002/2003 1 August 6th, 2003 10:41 AM





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