class ParentViewModel { public string ParentName { get; set; } public List<ChildViewModel> Children { get; set; } } class ChildViewModel { public string ChildName { get; set; } } |
Regards,
Pylori.
[Index.cshtml]
<div>
@Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.datasource).AllowPaging().Columns(col =>
{
...
})...Load("load").Render()
</div>
<script>
var data = @Html.Raw(Json.Encode(ViewBag.datasource));
function load(args) {
var grid = document.getElementById('Grid').ej2_instances[0]
grid.childGrid = {
dataSource: data,
queryString: 'EmployeeID',
created:created,
...
}
}
function created(args) {
this.dataSource = this.parentDetails.parentRowData.Employee; //Bind the data to Child Grid
}
</script>
|