IEnumerable datasource from C# code

4 posts, 0 answers
  1. Justin
    Justin avatar
    14 posts
    Member since:
    Dec 2011

    Posted 28 Feb 2012 Link to this post

    In my server side code I fetch the data to be displayed in the grid and it's returned as an IEnumerable. Can I use this as a datasource and if so how would I do this server side?
  2. Software Developer Austin
    Software Developer Austin avatar
    5 posts
    Member since:
    Dec 2008

    Posted 02 Mar 2012 Link to this post

    The KendoUI Grid is not bound to a Model. You have to bind it to JSON or ODATA client side. I just uploaded a sample to the Kendo Code Library showing how to do this in MVC.

    I load an IEnumerable object up and return it as JSON:

    return Json(person, JsonRequestBehavior.AllowGet);

    Kendo example can be found here:
    http://demos.kendoui.com/web/grid/remote-data.html

  3. Kendo UI is VS 2017 Ready
  4. Justin
    Justin avatar
    14 posts
    Member since:
    Dec 2011

    Posted 02 Mar 2012 Link to this post

    I actually found the answer to this in one of the Telerik videos. You can simply pass it in as a javascript array.

    Video:
    http://www.youtube.com/watch?v=gVu79Sh6Lpg&feature=player_embedded

    	dataSource:
    	{
    		data: sessions,
    		serverSorting: true
    	}

  5. Scott
    Scott avatar
    2 posts
    Member since:
    Mar 2014

    Posted 22 Mar 2014 Link to this post

    Does the dataSource have to be an IEnumerable, or can I bind to a single entity?
Back to Top
Kendo UI is VS 2017 Ready