Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Set the SiteMapNode Title Dynamically from Master Page ? ASP.NET

Status
Not open for further replies.

skyxn3t

IS-IT--Management
Aug 17, 2012
1
US
In My Web.sitemap I have the following:

<siteMapNode url="~/Groups/ViewGroups.aspx" urlRoute="groups/{PostId}/{PostTitle}" />
</siteMapNode>

In my MasterPage I have implemented the ItemDataBound event to try and set the title of each page that implements the master page dynamically but for some reason the title is not being set.

protected void SiteMapPath1_ItemDataBound(object sender, SiteMapNodeItemEventArgs e)
{
string CurrentNodeTitle = GetTitleFromDatabase();

if (e.Item.ItemType == SiteMapNodeItemType.Current) {
e.Item.SiteMapNode.Title = CurrentNodeTitle;
}
}

I also tried doing it in the ItemCreated event but still did not work.

If I set the title in the Web.sitemap then it works perfectly but when I set it using e.Item.SiteMapNode.Title = CurrentNodeTitle; the title is nto being set.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top