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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Trouble getting start with Hierarchy Grid

Thread ID:





128398 Jan 18,2017 07:17 PM UTC Jan 23,2017 03:44 AM UTC ASP.NET MVC (Classic) 4
Tags: Grid
Asked On January 18, 2017 07:17 PM UTC

Hi, I'm trying to set up a Hierarchy Grid, using the examples of thread #114261, and the following url 
https://help.syncfusion.com/aspnetmvc-classic/grid/hierarchical-grid    and I have two errors on my controller, and I can't figure it out. 

        public ActionResult ChildGrid(PagingParams args, int? capacitacion_id)
            var data = capacitacion.getListadoParticipantes(capacitacion_id);
            return data.GridActions<GetCapacitacionParticipantesResult>();

The first thing is in the parameter PagingParams args, the error is "cs0246 the type or namespace name 'PagingParams' could not be found"

The second error is in the return  data.GridActions<GetCapacitacionParticipantesResult>(); the error is cs1061 'IEnumerable' does not contain a definition for GridActions.

So, how can I fix this, in order to use, the Hierarchy Grid

Best regards

Isuriya Rajan [Syncfusion]
Replied On January 19, 2017 07:31 AM UTC

Hi Dayne, 
Thanks for contacting Syncfusion support, 
We have validated your mentioned issues and found the cause  .You have missed to refer the Syncfusion.Mvc.Grid namespace in your controller page.So we suggest to refer Syncfusion.Mvc.Grid namespace it will solve your mentioned issues. 

Please refer the below code example 
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.Mvc; 
using Syncfusion.Mvc.Grid; 
using ChildGridProperties.Models; 
using System.Collections; 

Please refer the below online sample link: 

If we misunderstood your query please get back to us. 

Isuriya R 

Replied On January 19, 2017 03:26 PM UTC

I can't refer the Syncfusion.Mvc.Grid namespace in my controller page, it doesn't appear as an option, check the image attached in the .rar file. Am I missing a reference?

Best regards

Attachment: Syncfusion_776dc24b.rar

Replied On January 19, 2017 10:14 PM UTC

So, I have missing the nuget package Syncfusion.AspNet.Mvc4.Classic, I only had installed the package Syncfusion.AspNet.Mvc4, so now I can add the reference properly. 

But, by using this syntax Html.Syncfusion().Grid() to build the Grid, I don´t have the option to Filter like Excel as I do using the syntax Html.EJ().Grid(), so I discard the solution provided by the link http://mvc.syncfusion.com/demos/ui/grid/Hierarchy/ServersideHierarchy, instead I use the example provided in the following URL https://www.syncfusion.com/kb/6316/how-to-pass-parentkey-from-parent-to-childgrid, but this example does not provide the controller code, and the child data does not load properly, so I give ypu my code.

        .Columns(col =>
                child =>
                         .FilterSettings(filter => { filter.FilterType(FilterType.Excel); })
                         .Columns(col =>
                             col.Field(p => p.FullName).HeaderText("Empleado").Width(35).TextAlign(Syncfusion.JavaScript.TextAlign.Right).Add();
                             col.Field(p => p.Empresa).HeaderText("Empresa").Width(35).TextAlign(Syncfusion.JavaScript.TextAlign.Right).Add();
                             col.Field(p => p.Dpto).HeaderText("Departamento").Width(35).TextAlign(Syncfusion.JavaScript.TextAlign.Right).Add();
                       .ClientSideEvents(eve => { eve.Load("loadEvent"); })


Javascript for the child grid

<script type="text/javascript">
    function loadEvent(args) {
        var data = this.model.parentDetails.parentKeyFieldValue;
        this.model.dataSource = ej.DataManager({ url: "/CapitalHumano/GetParticipantes?capacitacion_id=" + data + "", adaptor: "UrlAdaptor" });

Controller  function GetParticipantes, wich populate the child grid

 public ActionResult GetParticipantes(int? capacitacion_id)
            IEnumerable data = capacitacion.getListadoParticipantes(capacitacion_id).ToList();
            return Json(data, JsonRequestBehavior.AllowGet);

So, the question is, what am I doing wrong? Because the data variable has values, and the capacitacion_id variable is passed correctly...  But does not populate de grid.

Thanks in advance.

Isuriya Rajan [Syncfusion]
Replied On January 23, 2017 03:44 AM UTC

Hi Dayne, 
Query #1: But, by using this syntax Html.Syncfusion().Grid() to build the Grid, I don´t have the option to Filter like Excel  
We can enable the excel filter for Syncfusion grid.For this we have a method called  enableFiltering.By using this we can enable filtering. 
Please refer the below online documentation and sample link: 
Query #2: child data does not load properly 
Please refer the below code snippets for controller side. 
  public ActionResult ChildData(DataManager dm,int ? EmployeeID) 
            IEnumerable data = OrderRepository.GetAllRecords().ToList(); 
            DataResult result = new DataResult(); 
            DataOperations operation = new DataOperations(); 
            result.result = data; 
            result.result = operation.Execute(data, dm); 
            result.count = data.AsQueryable().Count(); 
            return Json(result, JsonRequestBehavior.AllowGet); 
Please refer the below sample for your reference: 

Isuriya R 


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