This is a migrated thread and some comments may be shown as answers.

How to use an Generic Object list as a DataSource

1 Answer 250 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 16 Sep 2015, 09:27 AM

Hi all,

I've seen all of the 4 episodes of the Getting Started with the Kendo UI for ASP.Net MVC, however I can't seem to figure out how to set up a DataSource with a Generic ObjectList.

This is the piece of code I currently have:

public JsonResult Get([DataSourceRequest] DataSourceRequest request)
{
            Runner runner = new Runner();
            Task<List<CustomOrder>> customOrderResult = Task.Run(async () => await runner.GetCustomOrders().ConfigureAwait(false));
            Task.WhenAll(customOrderResult);
            List<CustomOrder> customOrders = customOrderResult.Result;
}​

I know it ain't perfect. Going to refactor it as soon as I got it working properly.

Thanks in advance for all your help.

1 Answer, 1 is accepted

Sort by
0
Accepted
Genady Sergeev
Telerik team
answered on 18 Sep 2015, 01:30 PM
Hi Michael,

There are several demos that showcase how to bind the Grid on the server to a generic list. Consider the grid edit demo for example. Take a look at the EditController.cs class for details on the suggested implementation.

Regards,
Genady Sergeev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Elia
Top achievements
Rank 1
commented on 22 Feb 2023, 10:16 AM

The provided link is not valid any more. It leads to "Oh, no! It seems we've lost this page"
Genady Sergeev
Telerik team
commented on 22 Feb 2023, 01:15 PM | edited

Hello Elia,

Here is link that works: https://demos.telerik.com/aspnet-mvc/grid/editing-custom. Take a look at Editing_CustomControler.cs for additional information on the suggested implementation.

Genady

 

 

Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Share this question
or