Hello James
I think this post might be what you are looking for: https://gregwiechec.com/2018/03/hide-tabs-and-properties-in-edit-mode/
David
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
Have installed the nuget package and the hide and show methods dont seem to work
David does the following look okay to you?
[Display(
Name = "Field type",
Description = "Type of the field.",
GroupName = SystemTabNames.Content,
Order = 30)]
[CultureSpecific]
[BackingType(typeof(PropertyNumber))]
[Enum(typeof(FieldTypes))]
[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; }
[Display(
Name = "Select options",
GroupName = SystemTabNames.Content,
Order = 60)]
[EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor<DropDownListModel>))]
[CultureSpecific]
public virtual IList<DropDownListModel> SelectOptions { get; set; }
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.
So when field type is anything other than 'DropDown' I do not want the 'Select Options' part to appear. Is this possible?