我有一个带有List<string>
类型的模型和嵌套属性的表单。我在listview
更改时填充了combobox
:
<script>
function codeSelect(e)
{
var dataItem = this.dataItem(e.item.index());
var listView = $("#Accounts").data("kendoListView");
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: /*some url*/
}
}
});
listView.setDataSource(dataSource);
listView.refresh();
}
</script>
@(Html.Kendo().ComboBoxFor(model => model.Code)
.BindTo(/*somedata*/)
.DataTextField("CompanyName").DataValueField("code")
.Events(ev => { ev.Select("codeSelect"); }))
@(Html.Kendo().ListView(Model.Accounts)
.Name("Accounts")
.Selectable(sel => sel.Mode(ListViewSelectionMode.Multiple))
.ClientTemplateId("accounts_template")
.TagName("div")
.DataSource(dataSource => {
dataSource.Model(model => model.Id(p => p)); })
)
一切正常,除非我提交表单时收到Accounts
的0行列表。如何将listView选定的项目绑定到它?