Eric Bergman
Eric Bergman

Reputation: 1443

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

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;
    }
}

If I set the title in the then it works perfectly but when I set it using e.Item.SiteMapNode.Title = CurrentNodeTitle; the title is nto being set.

Upvotes: 0

Views: 1176

Answers (1)

mpulido
mpulido

Reputation: 1

In the Web.sitemap you must have in the Title someting like % vble %, If this value is a literal, no changes will applied

Upvotes: 0

Related Questions