Apparently I should not use tags in the post, they don't appear to be escaped. Trying again:
I was (happily) surprised to see that I can generate a MultiSelect on top of an existing select element, which is generated through Razor.
However, the control does not honour any option selected="selected" ..="" values, the input is rendered blank.
In order to get it to work, I had to instantiate it with a JSON serialized array of the selected options and wonder why that should be necessary.
Full sample is here:
https://stackblitz.com/edit/js-4nhpad
As you can see, the input in the sample is blank, despite the HTML output for the having options selected.
Extract (pseudo code):
select id="x" multiple
option 1
option 2 selected
option 3 selected
option 4
let xMultiSelect = new ej.dropdowns.MultiSelect({
placeholder: "Choose Option",
mode: "Box",
//value: @JsonHelper.Serialize(Model.xIds) // xIds is int[]; Why is this required? Why does it pick up options, but not values from selected?
}).appendTo("#x");