change "Show in navigation" default settings is not affecting pages

Farah El Agha asked on December 22, 2017 12:36

Hello guys, i have a project where I replaced the CMSMenuList web part with a regular repeater for display reasons, the structure is like in the picture Image Text

which led to bad consequences where for every page I create I would have to go to Properties> Navigation> uncheck show in navigation & show in sitemap I followed the steps to change the default settings to hide the page in navigation and sitemap my default so I went to CMSDesk > Content > Menu.aspx.cs and replaced:

  if (Node.GetValue("DocumentMenuItemHideInNavigation") != null)
        {
            chkShowInNavigation.Checked = !(Convert.ToBoolean(Node.GetValue("DocumentMenuItemHideInNavigation")));
        }
        else
        {
            chkShowInNavigation.Checked = false;
        }

        chkShowInSitemap.Checked = Convert.ToBoolean(Node.GetValue("DocumentShowInSiteMap"));

with:

            chkShowInNavigation.Checked = false;

        chkShowInSitemap.Checked = false;

Now when a new page is created the checkboxes are unchecked by default, and this solution should have been working, though the page name is still shown in the main menu navigation, the weird is when I go to the page properties, Navigation and click the Save button, the page is removed from the main menu. what could be the problem for the settings are not affecting the page on first creation?

Recent Answers


David te Kloese answered on December 22, 2017 15:53 (last edited on December 22, 2017 15:54)

Hi,

depending on the version it might be a known bug if you check this question: "devnet.kentico.com/../page-fields-default-values-ignored"

Or you could use the global handler method mentioned in the ticket above.

You can add these fields to the form tab like this:

Image Text

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.