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

Replace http://mvc.syncfusion.com/Services/Northwnd.svc/Orders/ From Datasource and use own data source.

Hello!

 

I'm new with Syncfusion. I'm trying Syncfusion MVC Control. But I've faced a problem, When working with Hierarchy Grid. I saw you use Northwnd.svc for Child Grid Data Source. But I want to use my own data source. Can you help me?


Thank You


1 Reply

AR Ajith R Syncfusion Team June 10, 2015 12:33 PM UTC

Hi Zahirul,

Thanks for using Syncfusion products.

Query: I want to use my own data source in the child Grid. Can you help me?

We suggest you to use your data source as either OData end point web service link or local data in the child Grid DataSource to perform the Hierarchy functionality in the Grid. Please refer the below code snippet for further details.

Web Service:


@(Html.EJ().Grid<EmployeeView>("HierarchyGrid")

    .Datasource((IEnumerable<object>)ViewBag.datasource)

    --------

    --------

    .ChildGrid(child =>

    {

        // Here you can replace your own web service link

        child.Datasource("http://mvc.syncfusion.com/Services/Northwnd.svc/Orders/")

        ------

        ------

    })


)


Local Data:

public ActionResult GridFeatures()

        {

            //Parent data source

            var DataSource = new NorthwindDataContext().EmployeeViews.ToList();

            ViewBag.datasource = DataSource;


            //Child data source

            var ChildData = new NorthwindDataContext().Orders.ToList();

            ViewBag.childData = ChildData;

            return View();
        }

@(Html.EJ().Grid<EmployeeView>("HierarchyGrid")

    .Datasource((IEnumerable<object>)ViewBag.datasource)

    --------

    --------

    .ChildGrid(child =>

    {

         // Here you can set your own local data

        child.Datasource((IEnumerable<object>)ViewBag.childData)

        ------

        ------

    })


)


Please refer the below link to know about the web service.

https://msdn.microsoft.com/en-us/magazine/dd943053.aspx
https://msdn.microsoft.com/en-us/library/8wbhsy70(v=vs.80).aspx

Please let us know if you have any concerns.

Regards,
Ajith R

Loader.
Live Chat Icon For mobile
Up arrow icon