Try our conversational search powered by Generative AI!

Set default value of VisibleInMenu in PageTypeBuilder.


I have a page type defined in PTB and for this particular page type, I want the pages to have the VisibleInMenu property set to false by default. But when I try to set VisibleInMenu = false in the constructor for my page type, I get the following error in Edit mode:

"Property 'PageVisibleInMenu' does not exist, can only assign values to existing properties"

A weird error message, since I'm not reaching for PageVisibleInMenu.

Any idea what the correct approach would be for changing the default value fo a property in a base class?

Aug 22, 2012 11:21

If you mean in the page type attribut the correct propertyname would be "DefaultVisibleInMenu" (DefaultVisibleInMenu = false).


Aug 22, 2012 13:09

This was not exactly what I was looking for, but it definitely solves the specific VisibleInMenu problem. Thank you!

But what if it is another property. If I want new pages of my page type to have its "Link type" set to "Shortcut to page in EPiServer CMS" and the "Internal Shortcut/Fetch Data from" set to the parent page, how could I do that?

Aug 22, 2012 13:46

Then I would attach an event to DataFactory.Instance.SavingPage in global.asax or a http module and do it from there.


Something like 

protected void Application_Start(Object sender, EventArgs e)
			DataFactory.Instance.SavingPage += Instance_SavingPage;           

		void Instance_SavingPage(object sender, EPiServer.PageEventArgs e)
			if (e.Page is SomePageType)
// Do magic


Aug 22, 2012 13:51

OK, but what if I only want it to be default when creating a new page, letting the user alter the value if he wants to?

Aug 22, 2012 13:55

Saving page was the wrong event, didn't think.. :)

LoadedDefaultPageData is what you are looking for (see

Aug 22, 2012 13:57

Looks messy, but ok. Thanks for enlightening me!

Aug 22, 2012 14:33
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.