Umbraco: Create CheckBoxList property with prevalues from mvc model

后端 未结 2 1190
小鲜肉
小鲜肉 2021-01-28 03:21

What I want to do is create a CheckBoxList property so the editor could choose facilities specific for current page (hotel name) in BO, and render content based on what is check

2条回答
  •  情话喂你
    2021-01-28 03:37

    I think you're thinking about this the wrong way as suggested by Stephen (unless I am misunderstanding your question). You are creating a list of key/value pairs and only one will be selected in the BO and so only one will published to the front-end (regardless of the use of it).

    So, in the BO you only need a dropdown list with the key/values pairs. You can create this with the "Dropdown list (publishing keys)" datatype. Also consider using the "SQL dropdown" list datatype as this would give you far more flexibility.

    If you then need to convert the selected ID into a Facility object, do this separately using a class implementing the IPropertyEditorValueConverter interface. See here for more information:

    http://our.umbraco.org/documentation/extending-umbraco/Property-Editors/PropertyEditorValueConverters

提交回复
热议问题