Asp.net mvc 单击“保存”按钮时绑定可编辑剑道网格项

Asp.net mvc 单击“保存”按钮时绑定可编辑剑道网格项,asp.net-mvc,model-view-controller,binding,kendo-grid,Asp.net Mvc,Model View Controller,Binding,Kendo Grid,我有下面的型号 public class CreateUserModel : DetailLayoutModel { public string UserName { get; set; } public string Email { get; set; } public List<UserSettingModel> Settings { get; set; } } public class UserSettingModel : Bas

我有下面的型号

  public class CreateUserModel : DetailLayoutModel
{        
    public string UserName { get; set; }
    public string Email { get; set; }
    public List<UserSettingModel> Settings { get; set; }
}

 public class UserSettingModel : BaseModel
{           
    public string Name { get; set; } 
    public int MaxPercentage { get; set; }
    public int MaxValue { get; set; }
    public int MinPercentage { get; set; }
    public int MinValue { get; set; }

}
公共类CreateUserModel:DetailLayoutModel
{        
公共字符串用户名{get;set;}
公共字符串电子邮件{get;set;}
公共列表设置{get;set;}
}
公共类UserSettingModel:BaseModel
{           
公共字符串名称{get;set;}
公共整数最大百分比{get;set;}
public int MaxValue{get;set;}
公共整数百分比{get;set;}
公共int最小值{get;set;}
}
我使用可编辑剑道网格的用户设置,如下所示:

当我按下创建列表时,用户设置列表为空! 我希望方法在单击“保存”按钮时绑定剑道网格

我使用Bind[“models”]但不工作 在我的例子中,我想绑定用户模型中存在的用户设置列表

编辑1:

剑道格网在视野中, 注意:剑道网格在打开时填充。它将用户设置绑定到网格 我的问题是: 1-当用户在网格中填充值并对其排序或分页时,值被重置 2-当用户单击提交按钮时,设置列表在收到创建操作时未填写,仅填写用户名和电子邮件

@(Html.Kendo().Grid<UserSettingModel>(Model.Settings).Name("settings")
            .Resizable(resize => resize.Columns(true))
            .Pageable(a => a.ButtonCount(5).Numeric(false).Input(true))
            .Scrollable(a => a.Enabled(true))
            .Sortable(a => a.SortMode(GridSortMode.MultipleColumn))
            .Selectable(a => a.Mode(GridSelectionMode.Single))
            .Filterable(a => a.Extra(true))
            .Editable(x=>x.Mode(GridEditMode.InCell))               
            .DataSource(dataSource => dataSource.Ajax()
            .PageSize(5)
            .ServerOperation(false)
            .Read(read => read.Action("GetSettings", "User"))
             .Model(model =>
             {
                 model.Id(o => o.Id);
                 model.Field(p => p.Name).Editable(false);
             }))
    .BindTo(Model.Settings)
    .Columns(columns =>
    {
        columns.Bound(p => p.Name).Title(GlobalResources.Name);
        columns.Bound(p => p.MinValue);
        columns.Bound(p => p.MinPercentage);
        columns.Bound(p => p.MaxValue);
        columns.Bound(p => p.MaxPercentage);

    })))
@(Html.Kendo().Grid(Model.Settings).Name(“Settings”)
.resize可调整大小(resize=>resize.Columns(true))
.Pageable(a=>a.ButtonCount(5).数字(false).输入(true))
.Scrollable(a=>a.Enabled(true))
.Sortable(a=>a.SortMode(GridSortMode.MultipleColumn))
.可选(a=>a.Mode(GridSelectionMode.Single))
.Filterable(a=>a.Extra(真))
.Editable(x=>x.Mode(GridEditMode.InCell))
.DataSource(DataSource=>DataSource.Ajax()
.页面大小(5)
.ServerOperation(错误)
.Read(Read=>Read.Action(“GetSettings”、“User”))
.Model(Model=>
{
model.Id(o=>o.Id);
model.Field(p=>p.Name).可编辑(false);
}))
.BindTo(Model.Settings)
.列(列=>
{
columns.Bound(p=>p.Name).Title(GlobalResources.Name);
columns.Bound(p=>p.MinValue);
columns.Bound(p=>p.MinPercentage);
columns.Bound(p=>p.MaxValue);
columns.Bound(p=>p.MaxPercentage);
})))

您是否尝试过将列表属性设置为默认值,例如:`model.settings=new list()'Yes..但效果不好。我需要有关如何创建和加载此属性的更多信息,然后我应该能够提供帮助。您是否有一个在dojo或JSFIDLE中使用此工具的演示?您必须将数据源传输读取添加到网格中。我认为您所指的绑定是初始绑定。如果您没有连接数据源读取方法,那么如何获取更新的数据?@David i编辑我的问题,,,请查看编辑1