Tuesday, March 13, 2012

SiteMap.CurrentMode property not available

I am trying to dynamically set the page title in the form load event of
my master page, but the CurrentNode property doesn't seem to be
available for some reason in the following code, the SiteMap object is
available to me and intellisense shows many methods and properties for
it, but CurrentNode is not in the list. However, I don't get any
indication at design time that it would cause an error. When I try to
run the code, I get the error:
"Error1'System.Web.UI.WebControls.SiteMapDataSource' does not contain
a definition for 'CurrentNode'"

Here is the code:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class TestApp : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
if (SiteMap.CurrentNode == null)
{
PageTitle.Text = "";
}
else
{
PageTitle.Text = SiteMap.CurrentNode.Title;
}

}
}

I have read that the .Net Framework 1.1 did not support the CurrentNode
property for the SiteMap object, but I am using the following version
of the dev environment:

Microsoft Visual Studio 2005
Version 8.0.50727.42 (RTM.050727-4200)
Microsoft .NET Framework
Version 2.0.50727

Installed Edition: Standard

Microsoft Visual Basic 2005 77633-235-0794681-41159
Microsoft Visual Basic 2005

Microsoft Visual C# 2005 77633-235-0794681-41159
Microsoft Visual C# 2005

Microsoft Visual C++ 2005 77633-235-0794681-41159
Microsoft Visual C++ 2005

Microsoft Visual J# 2005 77633-235-0794681-41159
Microsoft Visual J# 2005

Microsoft Visual Web Developer 2005 77633-235-0794681-41159
Microsoft Visual Web Developer 2005

DirectX extensions for Visual Studio
DirectX extensions for Visual Studio .NET

Any insight would be greatly appreciated.

RichRichard Carpenter wrote:

Quote:

Originally Posted by

I am trying to dynamically set the page title in the form load event of
my master page, but the CurrentNode property doesn't seem to be
available for some reason in the following code, the SiteMap object is
available to me and intellisense shows many methods and properties for
it, but CurrentNode is not in the list. However, I don't get any
indication at design time that it would cause an error. When I try to
run the code, I get the error:
"Error1'System.Web.UI.WebControls.SiteMapDataSource' does not contain
a definition for 'CurrentNode'"
>
Here is the code:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
>
public partial class TestApp : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
if (SiteMap.CurrentNode == null)
{
PageTitle.Text = "";
}
else
{
PageTitle.Text = SiteMap.CurrentNode.Title;
}
>
}
}
>
I have read that the .Net Framework 1.1 did not support the CurrentNode
property for the SiteMap object, but I am using the following version
of the dev environment:
>
Microsoft Visual Studio 2005
Version 8.0.50727.42 (RTM.050727-4200)
Microsoft .NET Framework
Version 2.0.50727
>
Installed Edition: Standard
>
Microsoft Visual Basic 2005 77633-235-0794681-41159
Microsoft Visual Basic 2005
>
Microsoft Visual C# 2005 77633-235-0794681-41159
Microsoft Visual C# 2005
>
Microsoft Visual C++ 2005 77633-235-0794681-41159
Microsoft Visual C++ 2005
>
Microsoft Visual J# 2005 77633-235-0794681-41159
Microsoft Visual J# 2005
>
Microsoft Visual Web Developer 2005 77633-235-0794681-41159
Microsoft Visual Web Developer 2005
>
DirectX extensions for Visual Studio
DirectX extensions for Visual Studio .NET
>
Any insight would be greatly appreciated.
>
Rich


Nevermind, folks. I walked away from it for a while and came back later
to take another stab at it. That was when I noticed I was referencing
the SiteMapDataSource rather than the actual SiteMap. The devil's in
the details.

Thanks anyway.
Rich

0 comments:

Post a Comment