2

我有一个带有模型和嵌套属性类型的表单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 选定项目绑定到它?

4

0 回答 0