We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

About hierarchical bindings of grid

Thread ID:





143652 Mar 30,2019 02:45 AM UTC Apr 2,2019 08:39 AM UTC ASP.NET MVC - EJ 2 3
Tags: Grid
Asked On March 30, 2019 02:48 AM UTC


Is it possible to do hierarchical binding easily without using "QueryString" for parent-child relationship view models as follows?

class ParentViewModel
    public string ParentName { get; set; }
    public List<ChildViewModel> Children { get; set; }

class ChildViewModel
    public string ChildName { get; set; }


Pavithra Subramaniyam [Syncfusion]
Replied On April 1, 2019 04:54 AM UTC

Hi Pylori, 
Thanks for contacting Syncfusion support.  
Query : Is it possible to do hierarchical binding easily without using "QueryString" for parent-child relationship view models as follows? 
No, The child Grid is bounded to the Parent row based on the “queryString” relation only. So defining the ‘queryString’ property is essential for the Hierarchical Binding feature. 
Pavithra S. 

Replied On April 1, 2019 10:54 AM UTC

Hi Pavithra S,

Thank you for answering.
Implement using "QueryString".


Pavithra Subramaniyam [Syncfusion]
Replied On April 2, 2019 08:39 AM UTC

Hi Pylori, 
Thanks for the update. 
We would like to explain the “Hierarchical binding in Grid”. The Grid will display as a hierarchy(parent-child) when the dataSource of the parent and child Grid have a common “field” name(which will be used as the value for “QueryString”), and by comparing the values of this field name, the child Grid will be displayed.  
Based on the shared model, we have prepared a sample by binding same dataSource for both child and parent Grids. We have achieved this requirement by using the “created” event of Child Grid. Please refer the code example and sample link below, 
    @Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.datasource).AllowPaging().Columns(col => 
    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', 
    function created(args) { 
        this.dataSource = this.parentDetails.parentRowData.Employee;          //Bind the data to Child Grid 
Documentations :  
Please get back to us if you need further assistance. 
Pavithra S. 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon