kendo 2015.1.318 \ JQuery 1.10.2 \ MVC 5
@(Html.Kendo().MultiSelectFor(m => m.SelectedUsers)
.Name("SelectedUsersBox")
.DataTextField("DisplayName")
.DataValueField("UserId")
.BindTo(Model.AllUsers)
)
When there are pre-existing items in the box and additional items are added (by typing in some letters and allowing the list to be filtered), some of the existing items which don't match the filter will be removed from the underlying select list. This causes empty items to be posted with the form.
For example a preexisting list of Andrea, Bob. The underlying select list looks like:
<select name="SelectedUsersBox" id="SelectedUsersBox" style="display: none;" multiple="multiple" data-role="multiselect">
<option value="1" selected="selected">Andrea</option>
<option value="2">Allan</option>
<option value="3" selected="selected">Bob</option>
</select>
If the letter "A" is typed into the box, "Andrea" is shown highlighted and "Allan" is not highlighted. As soon as the choice list is filtered to names beginning with "A", the underlying select list looks like (no name is selected\clicked):
<select name="SelectedUsersBox" id="SelectedUsersBox" style="display: none;" multiple="multiple" data-role="multiselect">
<option value="1" selected="selected">Andrea</option>
<option value="2">Allan</option>
<option selected="selected"/>
</select>
If "Allan" is selected the list looks like:
<select name="SelectedUsersBox" id="SelectedUsersBox" style="display: none;" multiple="multiple" data-role="multiselect">
<option value="1" selected="selected">Andrea</option>
<option value="2" selected="selected">Allan</option>
<option selected="selected"/>
</select>
If the form is posted at this point "Bob" is not one of the selected choices. In fact, one of the selected choices has no value!
Is this expected behavior? Am I missing a configuration\setting\property on the MultiSelectFor?
PS: If the user clicks on the box which brings up the entire menu, the select list is rebound and all of the values show up. Unfortunately, having a person click on the box to bring up the menu before submission is not a suitable solution.