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

Forums / Developing with Sitefinity / Page's Navigable property

Page's Navigable property

5 posts, 1 answered
  1. Hroc
    Hroc avatar
    2 posts
    Registered:
    05 Jul 2010
    20 Sep 2010
    Link to this post
    ICmsPage NotNavigablePage = (ICmsPage)manager.GetPage(ChildPageId, true);
    NotNavigablePage.Navigable = false;
    NotNavigablePage.Publish();
    I'm using the above code for changing a page's navigable property to false. I can see the page property being set to false, but the page is still displayed in the menu. Is there anything that i am missing? I am getting the correct GUID for ChildPageId.

    If i try to edit the page's navigable property from the CMS, it works. It just isnt working programmatically.

    Tariq.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    20 Sep 2010
    Link to this post
    Hi Hroc,

    Try using this code

    var manager = new CmsManager();
    // pass the id of a page you want to update
    var page = (ICmsPage)manager.GetPage(new Guid("e28056e6-5253-401c-89a7-dbafe8e1a32a"), true);
    page.Navigable = false;
    manager.SavePage(page);


    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  3. Hroc
    Hroc avatar
    2 posts
    Registered:
    05 Jul 2010
    21 Sep 2010
    Link to this post
    Thanks Ivan,
    That solved my problem.
  4. Sachin
    Sachin avatar
    18 posts
    Registered:
    10 Nov 2010
    27 Apr 2011
    Link to this post
    Hi Ivan,

    I am trying to do what you said but the pages aren't getting navigable. Its working fine through CMS if I try to do it manually.

    public partial class userControls_sitemap : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            makeAllAgentsNavigable();
            SiteMapRadTreeView.DataSource = new SiteMapDataSource();
            SiteMapRadTreeView.DataBind();
            SiteMapRadTreeView.ExpandAllNodes();       
        }
        public void makeAllAgentsNavigable()
        {
            var Manager = new CmsManager();
            CmsSiteMapNode stateRootNode = (CmsSiteMapNode) SiteMap.Provider.FindSiteMapNode("~/MovingCompanies.aspx");       
            IList allStates = stateRootNode.ChildNodes;
            foreach (CmsSiteMapNode stateNode in allStates)
            {
                var statePage = (ICmsPage)Manager.GetPage(new Guid(stateNode.PageID.ToString()), true);
                statePage.Navigable = true;
                Manager.SavePage(statePage);                
            }
        }
    }
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    29 Apr 2011
    Link to this post
    Hi Sachin,

    Can you check what are the properties for the page that is into transaction right after you call Manager.SavePage(statePage);  

    Kind regards,
    Ivan Dimitrov
    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
Register for webinar
5 posts, 1 answered