This is a migrated thread and some comments may be shown as answers.

MultiSelectFor with checkbox

1 Answer 295 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
Rainer
Top achievements
Rank 1
Rainer asked on 19 May 2016, 12:36 PM

Hi, i found an example of a Multiselect with checkbox on item templatem unfortunately only with UI syntax  and tried to use that in

MultiSelectFor in MVC but struggle with the item template. Can somebody help me please ?

Knowlege Article from UI

http://www.kendoui.io/kendo-ui/web/multiselect/how-to/checkbox-item-template#create-checkbox-custom-item-template

 

Here is my code for the editor template

@(
 Html.Kendo().MultiSelectFor(m => m)
        .DataTextField("Value")
        .DataValueField("Key")
        .ItemTemplate("<input type='checkbox'/> #:data.text#")
        .TagMode(TagMode.Single)
        .BindTo((System.Collections.IEnumerable)ViewData["FsrList"])
)

 

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 23 May 2016, 07:53 AM
Hello Rainer,

The ItemTemplate tries to render "text" property, which I believe is not present in this case. You will need to render the DataTextField instead:
.ItemTemplate("<input type='checkbox'/> #:data.Value#")

Regards,
Georgi Krustev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
MultiSelect
Asked by
Rainer
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or