Kendo ListView将所选项目作为嵌套属性MVC提交

时间:2015-03-31 12:23:16

标签: c# asp.net-mvc kendo-ui kendo-asp.net-mvc kendo-listview

我有一个带有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选定的项目绑定到它?

0 个答案:

没有答案