SF 3.7 to SF 5.0 Code Conversion

Posted by Community Admin on 04-Aug-2018 12:42

SF 3.7 to SF 5.0 Code Conversion

All Replies

Posted by Community Admin on 08-Mar-2012 00:00

Hi I was just wondering if someone could point me in the write direction to help me convert these 2 short blocks of code from 3.7 to 5.0
thank you in advance.
1)

try
Telerik.Cms.CmsManager cmsManager = new Telerik.Cms.CmsManager();
// get the current node of sitemap
Telerik.Cms.Web.CmsSiteMapNode currentNode = (Telerik.Cms.Web.CmsSiteMapNode)SiteMap.CurrentNode;
// get the CmsPage represented by the current node and extract its ID
Telerik.Cms.ICmsPage currentPage = currentNode.CmsPage;
Guid currentPageId = currentPage.ID;
hlink.NavigateUrl = "~/loadpages.aspx?guid=" + currentPageId.ToString();
hLinkWhole.NavigateUrl = "~/loadpages.aspx?guid=" + ParentPageGUID; // currentPageId.ToString();
//Telerik.Cms.Web.CmsSiteMapNode siteNode = (Telerik.Cms.Web.CmsSiteMapNode)SiteMap.Provider.CurrentNode;
 
//Response.Write(siteNode.RootNode.Title + ": " +siteNode.ParentNode.Title + ":" + siteNode.Title);
catch (Exception ex)


2)
protected void Page_Load(object sender, EventArgs e)
    try
    
    Telerik.Cms.CmsManager cmsManager = new Telerik.Cms.CmsManager();
    // get the current node of sitemap
    Telerik.Cms.Web.CmsSiteMapNode currentNode = (Telerik.Cms.Web.CmsSiteMapNode)SiteMap.CurrentNode;
    // get the CmsPage represented by the current node and extract its ID
    Telerik.Cms.ICmsPage currentPage = currentNode.CmsPage;
    Rev.Text += currentPage.Version.ToString();
    lbUpdated.Text += currentPage.DateModified.ToShortDateString();
    
    catch (Exception ex)
    
    


Thank you
Byron

Posted by Community Admin on 13-Mar-2012 00:00

Hello,

Generally the only thing you'll need to convert the below code would be getting the current PageSiteNode, please correct me if the desired use case scenario is different. You can achieve this functionality by using SiteMapBase like this:

var currentNode = SiteMapBase.GetActualCurrentNode();
var currentNodeId = currentNode.Id;

Kind regards,
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

This thread is closed