Try Now
More in this section

Forums / Developing with Sitefinity / Page API question

Page API question

2 posts, 0 answered
  1. Mahendra
    Mahendra avatar
    4 posts
    01 Sep 2006
    20 May 2010
    Link to this post
    New to Sitefinity API, I'm trying to retrieve all pages starting with the Sitemap, I'm using VB.
    Dim currentNode As Telerik.Cms.Web.CmsSiteMapNode = CType(SiteMap.CurrentNode, Telerik.Cms.Web.CmsSiteMapNode)
    always seems to return nothing. What am I doing wrong. Is there always a "CurrentNode" or is there a context I am missing? I am able to use cmsManager.getPages, that seems to work. Also, the following cast fails -
    Dim rootNode As Telerik.Cms.Web.CmsSiteMapNode = CType(SiteMap.Provider.RootNode, Telerik.Cms.Web.CmsSiteMapNode)
  2. George
    George  avatar
    204 posts
    05 Sep 2006
    20 May 2010
    Link to this post
    Hi Mahendra,

    here is how you loop through the SiteMap, this code is in C# but u can easily convert it to VB

    var rootNode = SiteMap.RootNode;
    foreach (CmsSiteMapNode node in rootNode.ChildNodes)
      //Add logic to the top level nodes here 
      //To loop further in the tree
      foreach (SiteMapNode childNode in node.ChildNodes)
        //Add your logic for child level 1 here

    Use this converter here to convert the C# code to VB.NET


2 posts, 0 answered