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

4.x API versus 3.7's API

2 posts, 0 answered
  1. Jason
    Jason avatar
    3 posts
    Registered:
    29 Oct 2010
    12 Dec 2011
    Link to this post
    I see where 4.x has a new Fluent API, but has this completely replaced the 3.7 API?

    In the process of trying to migrate a site I noticed that several bits of my code were broken. For example:

    Telerik.Cms.CmsManager cmsManager = new Telerik.Cms.CmsManager();
    CmsSiteMapNode sfNode = (CmsSiteMapNode)node;
     
    StringBuilder markup = new StringBuilder();
    if (sfNode == null)
        return markup;
     
    var children = cmsManager.GetPages(sfNode.PageID);
     
    foreach (CmsPage child in children){
        //...
    }


    That example from a 3.7 custom control is not function in 4.3. I can see where the Telerik.Cms namespace has been replaced with the Telerik.Sitefinity namespace, but even taking that into account that is not enough to resolve this issue. It appears that the CmsPage class no longer exists and that the CmsManager class is gone as well.

    Is there any guidance for migrating custom controls to 4.3?

    Thanks!
  2. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    12 Dec 2011
    Link to this post
    Your best bet is to reference the new Sitefinity 4 documentation, which shows specific examples on working with Pages and Content Module items.

    For example, the Querying Pages documentation shows how to retrieve pages using both the native PageManager API (similar to how you did things in 3.x) and the new Fluent API.

    If you are trying to get the current page from the control, you can use this code:

    var currentNode = Telerik.Sitefinity.Web.SiteMapBase.GetActualCurrentNode();

    i hope this is helpful!
2 posts, 0 answered