No longer able to get Page Description

Posted by Community Admin on 04-Aug-2018 14:55

No longer able to get Page Description

All Replies

Posted by Community Admin on 12-Aug-2011 00:00

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

Posted by Community Admin on 16-Aug-2011 00:00

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

Posted by Community Admin on 17-Aug-2011 00:00

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

Posted by Community Admin on 17-Aug-2011 00:00

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

Posted by Community Admin on 12-Oct-2011 00:00

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" />

Posted by Community Admin on 12-Oct-2011 00:00

Hi,

you can test this :

SiteMapNode cNode = e.Item.DataItem as SiteMapNode;
PageNode node = (PageNode)cNode;
string desc = node.GetString("Description");


Regards,
Nicolas

Posted by Community Admin on 31-May-2012 00:00

I have the same issue!
We are using SF 5.0.2500.0

Posted by Community Admin on 16-Jun-2015 00:00

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

This thread is closed