Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

How to show/hide properties in the CMS block editor


I have created a new block which contains a table allowing people to enter fields they want to appear in the view. They select the type while they do this and one of the types in 'DropDown'. While entering what fields they would like they also have the option to add select options. I only want the select options part to appear when they have select the type 'DropDown'. The documentation around this on the Episerver site is not great and only mentions how to edit out the box blocks not custom built ones.

enter image description here

So when field type is anything other than 'DropDown' I do not want the 'Select Options' part to appear. Is this possible?

Jan 11, 2019 12:56

Hello James

I think this post might be what you are looking for:


Jan 11, 2019 13:21

Hi David,

Thanks for the link. Have had a look and it mentions using ShowPropertyWhenValueEquals. Do you happen to know which library this method comes from? Epi doesnt seem to know it.

Thanks, James

Jan 11, 2019 14:59

Have installed the nuget package and the hide and show methods dont seem to work

Jan 11, 2019 15:55

David does the following look okay to you?

Name = "Field type",
Description = "Type of the field.",
GroupName = SystemTabNames.Content,
Order = 30)]
[HidePropertyWhenValueEquals(nameof(SelectOptions), FieldTypes.Button)]
[HidePropertyWhenValueEquals(nameof(SelectOptions), FieldTypes.CheckBox)]
[HidePropertyWhenValueEquals(nameof(SelectOptions), FieldTypes.CountryDropDown)]
[HidePropertyWhenValueEquals(nameof(SelectOptions), FieldTypes.Email)]
[HidePropertyWhenValueEquals(nameof(SelectOptions), FieldTypes.Phone)]
[HidePropertyWhenValueEquals(nameof(SelectOptions), FieldTypes.Text)]
[HidePropertyWhenValueEquals(nameof(SelectOptions), FieldTypes.TextArea)]
public virtual FieldTypes Type { get; set; }

Name = "Select options",
GroupName = SystemTabNames.Content,
Order = 60)]
[EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor<DropDownListModel>))]
public virtual IList<DropDownListModel> SelectOptions { get; set; }

Jan 11, 2019 16:49
* 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.