Try our conversational search powered by Generative AI!

PageTypeBuilder - defaultValue not being set on property

Vote:
 

Hello everybody,

I have a CMS 6 project and working on, and I'm using PTB 2.0.

My problem is that I have a boolean property which I want to set a default value of "true" for all the pages. IT will render as a checkbox. But for some reason, this is not working, the checkbox is added but it's unmarked.  My property declaration looks like this:

 [PageTypeProperty(Type = typeof(PropertyBoolean), Searchable = false, UniqueValuePerLanguage = true, SortOrder = 1500, DefaultValue = true)]
 public virtual bool ShowInSiteMap { get; set; }


What am I doing wrong?

 

/Kenia

#58471
Apr 26, 2012 10:47
Vote:
 
#58472
Apr 26, 2012 10:58
Vote:
 

I think you are missing DefaultValueType=EPiServer.DataAbstraction.DefaultValueType.Value

DefaultValueType is an enum with the following values Inhertit, None and Value.

[PageTypeProperty(Type = typeof(PropertyBoolean),
Searchable = false,
UniqueValuePerLanguage = true,
SortOrder = 1500,
DefaultValue = true,
DefaultValueType=EPiServer.DataAbstraction.DefaultValueType.Value)]
public virtual bool ShowInSiteMap { get; set; }

#58473
Edited, Apr 26, 2012 11:00
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.