What Block Type property should I use for an interface that displays Yes/No radio buttons?


The specs for a new block that I need to construct require a Yes/No radio button pair.  My initial thought was to make this a bool, but according to the link below the editing experience for the Boolean property type is a checkbox.


What is the correct procedure for creating the Model Block Type property and the corresponding partial view to display Yes/No radio buttons?  Thanks for your help.

Jan 26, 2018 19:35

It sounds like you are collecting form data from the user, so I would consider using Episerver Forms. You can build a form in CMS Edit, add it to a ContentArea on the page, and with @Html.PropertyFor(x => x.MyContentArea), Episerver will render the form by itself (including any radiobuttons that you supply). On form submit, it will collect the form data and store it for you without having to write any code. 

Jan 27, 2018 15:41

Usually the standard if you want to present different text options is a dropdown such as here http://joelabrahamsson.com/enum-properties-with-episerver/ or https://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/8/Content/Properties/Property-types/Single-or-multiple-list-options/ but you might be able to change the ClientEditingClass to be a radio button control.

Jan 29, 2018 9:59

Thank you. I was heading down the wrong path and should have been using EPiServer Forms.  Good call Drew.

Feb 01, 2018 15:08
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.