public
class UserModel
{
public
IEnumerable<RoleModel> RoleModels { get; set; }
}
public
class RoleModel
{
public int Id { get; set; }
public string Name { get; set; }
public bool InRole { get; set; }
}
~User.cshtml
@(Html.Kendo().Grid<Mrjiou.Models.UserModel>()
.Name(
"Grid")
.Editable(editable => {
editable.Mode(
GridEditMode.PopUp).TemplateName("UserEditor"); })
.Columns(columns =>
{
columns.Bound(u => u.Name);
columns.Command(command => {
command.Edit();
})
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(m => m.Id))
.ServerOperation(
false)
.Read(read => read.Data(
"additional_data").Action("User_Read", "User"))
.Update(update=>update.Action("User_Update", "User"))
)
~UserEditor.cshtml:
@Html.LabelFor(m => m.Name)
@Html.EditorFor(m => m.Name)
@Model.RoleModels.Count()
@Html.EditorFor(m => m.RoleModels,
"UserRoleEditor")the problem is i can't get RoleModels in UserEditor.cshtml,it's alway null. what's the problem?