Hey!
I'm creating a view, based on a ViewModel. This View Model has two Complex Properties, of which one is collection
Second Property (viz. secList) is collection which displays two columns in grid(Description, Action, Rest are hidden). Action is a list of CheckBoxes.
Action Method to fill the View is:
Razor Code which Renders Kendo Grid is:
@(Html.Kendo().Grid(Model.secList)
.Name("secList")
.Columns(columns =>
{
columns.Bound(p => p.SecurityListId).Hidden();
columns.Bound(p => p.HubId).Hidden();
columns.Bound(p => p.FormId).Hidden();
columns.Bound(p => p.DataActionId).Hidden();
columns.Bound(p => p.Description).Width(450).Filterable(true);
columns.Bound(p => p.Action).Width(50).Sortable(false).Filterable(false);
.HeaderTemplate("<div align=center><p>Select All </p><input id='selectall' type='checkbox' checked= 'checked' /></div>")
.ClientTemplate("<div align=center><input type='checkbox' checked='checked' /></div>");
})
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.Model(model =>
{
model.Id(p => p.SecurityTemplateId);
model.Field(p => p.Description).Editable(false);
model.Field(p => p.Action).Editable(true);
}))
.Sortable()
.Scrollable()
.Filterable()
.HtmlAttributes(new { style = "height:530px;" })
);
All i need from grid to show Description and List of Checkboxes. Logic of Insertion is on Action (Post) in Controller.
My Issue is I'm able to display gird, but when I try to access this collection on Create (Post), the model Property (secList) is null. Can you please advise from where I'm getting it wrong?
I'm creating a view, based on a ViewModel. This View Model has two Complex Properties, of which one is collection
public
class
SecurityTemplateViewModel
{
public
SecurityTemplate secTemp {
get
;
set
; }
public
List<SecurityListViewModel> secList {
get
;
set
; }
}
}
Second Property (viz. secList) is collection which displays two columns in grid(Description, Action, Rest are hidden). Action is a list of CheckBoxes.
Action Method to fill the View is:
public
ActionResult Create()
{
SecurityTemplateViewModel secTempVM =
new
SecurityTemplateViewModel();
var securityList = _secTemp.GetSecurityList();
secTempVM.secList = securityList;
return
View(secTempVM);
}
Razor Code which Renders Kendo Grid is:
@(Html.Kendo().Grid(Model.secList)
.Name("secList")
.Columns(columns =>
{
columns.Bound(p => p.SecurityListId).Hidden();
columns.Bound(p => p.HubId).Hidden();
columns.Bound(p => p.FormId).Hidden();
columns.Bound(p => p.DataActionId).Hidden();
columns.Bound(p => p.Description).Width(450).Filterable(true);
columns.Bound(p => p.Action).Width(50).Sortable(false).Filterable(false);
.HeaderTemplate("<div align=center><p>Select All </p><input id='selectall' type='checkbox' checked= 'checked' /></div>")
.ClientTemplate("<div align=center><input type='checkbox' checked='checked' /></div>");
})
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.Model(model =>
{
model.Id(p => p.SecurityTemplateId);
model.Field(p => p.Description).Editable(false);
model.Field(p => p.Action).Editable(true);
}))
.Sortable()
.Scrollable()
.Filterable()
.HtmlAttributes(new { style = "height:530px;" })
);
All i need from grid to show Description and List of Checkboxes. Logic of Insertion is on Action (Post) in Controller.
My Issue is I'm able to display gird, but when I try to access this collection on Create (Post), the model Property (secList) is null. Can you please advise from where I'm getting it wrong?