Try our conversational search powered by Generative AI!

Hiding Boolean property


While Joels exampel:
Works like a charm for categoryList, I cannot get it to work wih the type bool. 

Also reading,

The code below is a mixup from Joels example and episerver sdk, but I cannot get it to work, is there something I have missed?

using System;

using System.Collections.Generic;

using EPiServer.Shell.ObjectEditing;

using EPiServer.Shell.ObjectEditing.EditorDescriptors;

using EPiServer.Templates.Alloy.Models.Pages;


namespace EPiServer.Templates.Alloy.Business.EditorDescriptors





        /// Editor descriptor that will create a checkbox to be able to edit boolean values.


        [EditorDescriptorRegistration(TargetType = typeof(bool))]

        publicclassBooleanEditorDescriptor : EditorDescriptor


            public override void ModifyMetadata(

          ExtendedMetadata metadata,

          IEnumerable<Attribute> attributes)


                base.ModifyMetadata(metadata, attributes);


                dynamic mayQuack = metadata;

                var ownerContent = mayQuack.OwnerContent;

                if (ownerContent is StandardPage)


                    metadata.ShowForEdit = false;






Apr 22, 2013 21:13

It should be bool? :)

Apr 23, 2013 15:51

@Duong Nguyen: What do you mean?

Apr 23, 2013 16:35

Sorry, made you confused. The value type in Boolean properties are Nullable<bool>. So you have to register your editor descriptor to the type bool? instead of bool.

Apr 23, 2013 16:38
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.