Kendo ui 剑道UI网格批量保存-模型在服务器上发布后为空

Kendo ui 剑道UI网格批量保存-模型在服务器上发布后为空,kendo-ui,kendo-grid,kendo-asp.net-mvc,Kendo Ui,Kendo Grid,Kendo Asp.net Mvc,我正在尝试在剑道的网格上设置批量编辑,就像他们演示站点上的示例一样-。一切似乎都设置正确,并且它将数据从网格正确地(似乎)发布到服务器。当我在firebug中查看post数据时,它是完全正确的,但是在服务器上调试发回的模型时,所有的模型都包含null或空字符串值。.Count中正确显示了模型数,但它们为空。这是我的代码和输出,抱歉,我还不能发布图片,网站上的点数还不够: aspx页面: <%: Html.Kendo().Grid<Thread.Site.Models.ModelSum

我正在尝试在剑道的网格上设置批量编辑,就像他们演示站点上的示例一样-。一切似乎都设置正确,并且它将数据从网格正确地(似乎)发布到服务器。当我在firebug中查看post数据时,它是完全正确的,但是在服务器上调试发回的模型时,所有的模型都包含null或空字符串值。.Count中正确显示了模型数,但它们为空。这是我的代码和输出,抱歉,我还不能发布图片,网站上的点数还不够:

aspx页面:

<%: Html.Kendo().Grid<Thread.Site.Models.ModelSummary>()
            .Name("Grid")
            .Columns(columns =>
            {
                columns.Bound(m => m.ModelID).Hidden();
                columns.Bound(m => m.ModelNumber).Width(100).ClientTemplate("#= (ModelNumber === 'null') ? ' ' : ModelNumber #");
                columns.Bound(m => m.ModelName);
                columns.Bound(m => m.Content).Width(160);
                columns.Bound(m => m.Bullet1);
                columns.Bound(m => m.Bullet2);
                columns.Bound(m => m.Bullet3);
                columns.Bound(m => m.Bullet4);
                columns.Bound(m => m.Bullet5);
                columns.Bound(m => m.Bullet6);
                columns.Bound(m => m.AlertCount).ClientTemplate("# if (AlertCount > 0) { # <span class='icons icons-alert viewCheck' title='#= AlertCount # Alert(s)'></span> #}#").Title("Attention");//"#= (AlertCount === 0) ? ' ' : AlertCount #").Title("Attention");//
            })
            .Pageable()
            .ToolBar(
                toolbar => {toolbar.Save();}
            )
            .Editable(edit => { edit.Mode(Kendo.Mvc.UI.GridEditMode.InCell); })
            .Navigatable(n => { n.Enabled(true);})
            .Sortable()
            .Scrollable(s=>s.Height(500)) 
            .Selectable(selectable => selectable.Mode(Kendo.Mvc.UI.GridSelectionMode.Single))
            .Filterable()
            .Events(events =>
            {
                events.DataBound("dataBound");
                events.Edit("edit");
                events.Change("change");
            })
            .DataSource(dataSource => dataSource
                .Ajax()
                .Batch(true)
                .ServerOperation(false)
                .PageSize(15)
                .Events(events => events.Error("error_handler"))
                .Model(model =>
                {
                    model.Id(j => j.ModelID);
                    model.Field(j => j.ModelID).Editable(false);
                    model.Field(j => j.ModelNumber).Editable(false);
                })
                .Read(read => read.Action("ModelList_Read", "Models", new { jobID = job.JobID }))
                .Update(update => update.Action("ModelList_SaveAll", "Models").Type(HttpVerbs.Post))
            )
        %>
服务器上的调试模型(\u控制器中的modelSummary),所有数据均为空或空:

modelSummary.Count = 1

Bullet1 null    string
Bullet1ID   0   int
Bullet2 null    string
Bullet2ID   0   int
Bullet3 null    string
Bullet3ID   0   int
Bullet4 null    string
Bullet4ID   0   int
Bullet5 null    string
Bullet5ID   0   int
Bullet6 null    string
Bullet6ID   0   int
CompanyID   0   int

感谢您在这方面的帮助。

我修改了您的数据源模型。您的主ID必须是defaultvalue

.Model(model =>
                {
                    model.Id(j => j.ModelID);
                    model.Field(p => p.ModelID).DefaultValue(16000000);
                    model.Field(j => j.ModelID).Editable(false);
                    model.Field(j => j.ModelNumber).Editable(false);
                })

我有完全相同的问题。我不理解默认值的必要性。你能解释一下吗?请看这篇文章了解问题的解决方法。那是为了我。我希望这对你也有帮助。
modelSummary.Count = 1

Bullet1 null    string
Bullet1ID   0   int
Bullet2 null    string
Bullet2ID   0   int
Bullet3 null    string
Bullet3ID   0   int
Bullet4 null    string
Bullet4ID   0   int
Bullet5 null    string
Bullet5ID   0   int
Bullet6 null    string
Bullet6ID   0   int
CompanyID   0   int
.Model(model =>
                {
                    model.Id(j => j.ModelID);
                    model.Field(p => p.ModelID).DefaultValue(16000000);
                    model.Field(j => j.ModelID).Editable(false);
                    model.Field(j => j.ModelNumber).Editable(false);
                })