I am using some code pulled from one of the Kendo examples for connecting two ListBoxes (populating the first with an AJAX call, and then letting the user transfer some of the items to the second listbox.
I currently have this set with an "EditorFor" approach.
Everything works fine, except that my Model never gets the selected users.
In the Model, that field is:
IEnumerable<UserModel> SelectedEmployees
No matter what I've tried, the selected employees never get sent back to the Model with the other bits.
If I use jQuery to dump the dataitems to the Console, I can see what users have been selected. They just don't go back to my model.
Is this possible? Am I way out to lunch? Or just missing something?
@using WMGPipeline.Models
@model IEnumerable<
UserModel
>
<
div
>
<
input
type
=
'text'
id
=
'searchBox'
class
=
'k-textbox'
placeholder
=
'Search By Name'
/>
<
br
/>
@(Html.Kendo().ListBox()
.Name("employees")
.Toolbar(toolbar => {
toolbar.Position(Kendo.Mvc.UI.Fluent.ListBoxToolbarPosition.Right);
toolbar.Tools(tools => tools
.TransferTo()
.TransferFrom()
.TransferAllTo()
.TransferAllFrom()
.Remove()
);
})
.ConnectWith("SelectedEmployees")
.DataTextField("LastFirst")
.DataValueField("UserID")
.DataSource(source => {
source.Custom()
.ServerFiltering(true)
.Type("aspnetmvc-ajax")
.Transport(transport => {
transport.Read("getEmployees", "Pipeline");
})
.Schema(schema => {
schema.Data("Data").Total("Total");
});
})
)
@(Html.Kendo().ListBox()
.Name("SelectedEmployees")
.DataTextField("LastFirst")
.DataValueField("UserID")
.BindTo(Model)
.Selectable(ListBoxSelectable.Multiple)
)
/
div
>