Hello,
I have model that looks like
public class VacUserSecurityModel
{
private bool isCurrentUser;
public VacUserSecurityModel()
{
this.Claims = new List<UserClaim>();
}
public string Id { get; set; }
public string Email { get; set; }
public string UserName { get; set; }
[UIHint("ClaimsEditor")]
public List<UserClaim> Claims { get; set; }
}
Here is a grid
@(Html.Kendo().Grid<VacUserSecurityModel>
()
.Name("allGrid")
.DataSource(datasource => datasource.Ajax().Read(read => read.Action("ReadAllUserClaims", "Authorization"))
.Update(update => update.Action("UpdateUserClaims", "Authorization"))
.Model(model =>
{
model.Id(p => p.Id);
model.Field(p => p.UserName).Editable(false);
model.Field<List<UserClaim>>(e => e.Claims);
}))
.NoRecords(x => x.Template("<div class='k-grid-norecords-template'>No records</div>"))
.Editable(editable => editable.Mode(GridEditMode.PopUp))
.HtmlAttributes(new { style = "height:550px;" })
.Columns(columns =>
{
columns.Bound(c => c.Id).Visible(false).Title("ID");
columns.Bound(c => c.UserName).Width(250).Title("User");
columns.Bound(c => c.Claims).ClientTemplate("#=claimsTemplate(Claims)#");
columns.Command(commands => { commands.Edit(); });
})
)
Claims Editor:
@model Models.Authorization.VacUserSecurityViewModel
@(Html.Kendo().MultiSelect()
.Name("RoleClaims")
.Placeholder("Select roles")
.DataTextField("ClaimValue")
.DataValueField("ClaimValue")
.BindTo((System.Collections.IEnumerable) ViewData["RolesDictionary"]))
How do I need to change the grid definition to bind Claims property to be able to edit this collection? During update, Claims property has old values regardless what I select.
Any help will be appreciated.