+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / No longer able to get Page Description

No longer able to get Page Description

8 posts, 0 answered
  1. Phill Hodgkinson
    Phill Hodgkinson avatar
    362 posts
    Registered:
    10 Nov 2004
    12 Aug 2011
    Link to this post
    Before upgrading to 4.2 I was able to get the page description using the following code, now whatever I try the description is always just an empty string. Any ideas?
    protected void Repeater_OnItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        SiteMapNode cNode = e.Item.DataItem as SiteMapNode;
        PageNode node = (PageNode)cNode;
        string desc = node.Description // this is now always empty, but used to work
    }

    The above is code behind for a simple repeater that was bound to asp:SiteMapDataSource but I get the same problem when using the new SitefinitySiteMapDataSource.

    Thanks in advance,
    Phill
  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    19 Sep 2016
    16 Aug 2011
    Link to this post
    Hi Phill Hodgkinson,

    Can you please make sure that you are working with the Description property of the PageData object, not the PageNode? I have just tested the described functionality and it seems to be working fine. PLease take a look at the below sample code:
    var myPage = App.WorkWith()
                                .Pages()
                                .ThatArePublished()
                                .LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend)
                                .Where(p =>p.Page != null && p.Page.Title == "Home")
                                .Get()
                                .FirstOrDefault();
     
                var descr = myPage.Page.Description;
    which will return the content of the Description property for my "Home" page.

    Greetings,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Phill Hodgkinson
    Phill Hodgkinson avatar
    362 posts
    Registered:
    10 Nov 2004
    17 Aug 2011
    Link to this post
    Hi Boyan,

    I will give your sample code a try. I do wonder if this is the most efficient way to get page description since I have to make this call OnDataItemBound for each item in the menu. Also, part of the reason that I posted this issue was that using PageSiteNode worked before upgrading to 4.2 and then it just stopped working (aka another undocumented breaking change).

    I'll let you know if the below works for me but again I fear it's not a very efficient way to get a page description.

    Regards,
    Phill
  4. Phill Hodgkinson
    Phill Hodgkinson avatar
    362 posts
    Registered:
    10 Nov 2004
    17 Aug 2011
    Link to this post
    Hi Boyan,

    So your solution doesn't work for me, the page Description always returns as an empty string. I was able to get things to work using the Page manager. The following code works for me, but again I find it strange that I have to do this every time a menu node renders and that there are so many references to page description (i.e. PageSiteNode) but they're always empty. 

    ISitefinitySiteMapNode smNode = e.Item.DataItem as ISitefinitySiteMapNode;
    var pageNode = smNode as PageSiteNode;
    var pManager = Telerik.Sitefinity.Modules.Pages.PageManager.GetManager();
    PageData page = pManager.GetPageData(pageNode.PageId);
    string desc = page.Description;


    I'd still like to know what the optimal solution is or if this is indeed it.

    Regards,
    Phill
  5. Tom Miller
    Tom Miller avatar
    52 posts
    Registered:
    27 Feb 2010
    12 Oct 2011
    Link to this post
    Getting similar error with the following code.  This use to work in 4.1 but no longer does in 4.2.  See the "Eval("Description")" line below.

    <%@ Control Language="C#" AutoEventWireup="true" %>
    <telerik:RadTabStrip ID="RadPanelpageNav" runat="server" Visible="false" />
     
    <asp:Repeater  ID="Repeater1" runat="server" DataSourceID="SiteMapDataSource" >
        <HeaderTemplate>
            <ul class="page-nav-holder">
        </HeaderTemplate>
        <ItemTemplate>
                <li>
                    <a href='<%# Eval("Url") %>' runat='server'>
                        <h3><%# Eval("Title") %></h3>
                        <p><%# Eval("Description") %></p>
                    </a>
                </li>
        </ItemTemplate>
        <FooterTemplate>
            </ul>
        </FooterTemplate>
    </asp:Repeater>
     
    <asp:SiteMapDataSource runat="server" ID="SiteMapDataSource" StartingNodeOffset="0" ShowStartingNode="false" />
  6. Nicolas
    Nicolas avatar
    156 posts
    Registered:
    19 Jan 2011
    12 Oct 2011
    Link to this post
    Hi,

    you can test this :
    SiteMapNode cNode = e.Item.DataItem as SiteMapNode;
    PageNode node = (PageNode)cNode;
    string desc = node.GetString("Description");


    Regards,
    Nicolas
  7. Ralph
    Ralph avatar
    4 posts
    Registered:
    18 Jan 2012
    31 May 2012
    Link to this post
    I have the same issue!
    We are using SF 5.0.2500.0
  8. bravohex
    bravohex avatar
    1 posts
    Registered:
    09 Jun 2015
    16 Jun 2015
    Link to this post
    You can try this:
    var des = page.GetPageData().Description
    // The statement "page.Description" always returns as an empty string. I don't know why
    This work for me
8 posts, 0 answered