Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
143652 | Mar 30,2019 02:45 AM UTC | Apr 2,2019 08:39 AM UTC | ASP.NET MVC - EJ 2 | 3 |
![]() |
Tags: Grid |
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>
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.