More in this section

Forums / Bugs & Issues / Title of the current SiteMapNode doesn't appear

Title of the current SiteMapNode doesn't appear

6 posts, 0 answered
  1. Vitaly
    Vitaly avatar
    13 posts
    Registered:
    04 Mar 2009
    13 Dec 2010
    Link to this post
    Hi all,

    I've implemented custom control to show title of the page. Following code works in Beta 2 but property Title is empty for RC. Could you please provide correct way to get title of the page?

    litTitle = container.GetControl<Literal>("litTitle", true);
    SiteMapNode node = SiteMapBase.GetCurrentProvider().CurrentNode;
     
    if (node != null)
    {
        litTitle.Text = node.Title;
    }
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    13 Dec 2010
    Link to this post
    Hi Vitaly,

    I checked the node.Title property in the RC and it is properly set.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Vitaly
    Vitaly avatar
    13 posts
    Registered:
    04 Mar 2009
    13 Dec 2010
    Link to this post
    Hi Ivan,

    Thank you for your response. Unfortunately, I'm using this code in control which implemented in separated assembly. It doesn't work for me. Also, I've updated to last version of the SF 4 (4.0.992.0) without result.  
    Please let me know if you have any ideas or questions. 

    I can't attach video file (in swf format). I can send it directly by e-mail. 



  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    13 Dec 2010
    Link to this post
    Hi Vitaly,

    Could you try using instance of PageNode which has a property Page.Title which is the name of the page.

    var pageNode = _SiteMapNode asPageSiteNode;
    var pn = man.GetPageNode(pageNode.Id);


    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Vitaly
    Vitaly avatar
    13 posts
    Registered:
    04 Mar 2009
    14 Dec 2010
    Link to this post
    Hi Ivan,

    I found only one way to implement this feature. It's workaround but I hope it will be tested and fixed in next releases.
    My code snippet:
    litTitle = container.GetControl<Literal>("litTitle", true);
    SiteMapNode node = SiteMapBase.GetCurrentProvider().CurrentNode;
     
    if (node != null && node.ParentNode != null)
    {
     
        foreach (SiteMapNode n in node.ParentNode.ChildNodes)
        {
            if (n.Key == node.Key)
            {
                litTitle.Text = n.Title;
                break;
            }
        }
    }

  6. Phill Hodgkinson
    Phill Hodgkinson avatar
    362 posts
    Registered:
    10 Nov 2004
    14 Dec 2010
    Link to this post
    Hi Vitaly,

    I'm wondering if you've tried this approach? I came across it in another thread and it works well for me.

    string title = new PageManager().GetPageNode(new Guid(SiteMapBase.GetCurrentProvider().CurrentNode.Key)).Title;


    Regards,
    Phill

    Edit: I should note that I use this in code behind of a usercontrol, so your scenario might be a bit different.
6 posts, 0 answered