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

ToDatasourceResult is not working

7 Answers 2357 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ShanthaKumar
Top achievements
Rank 1
ShanthaKumar asked on 28 Jun 2013, 12:34 PM
Hi team,

I am new to Kendo UI Grid, for the last two days trying to do custom pagination for kendo grid using Stored Procedure which takes care of pagination with the pageindex and pagesize as sql parameters, for which I dint see any example.

When I exactly followed the steps to do pagination(http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/ajax-binding)  I am getting the following error

System.Linq.IQueryable<object> doesn't contain a definition for ToDataSourceResult and no extension method for ToDataSourceResult accepting a first argument of type System.Linq.IQueryable<object>

I have already included Kendo.MVC.UI namespace in my code.

Please let me know where I am going wrong for ToDataSourceResult.

Regards
VKC


7 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 28 Jun 2013, 01:03 PM
Hi,

To use the ToDataSourceResult extension method you need to import the Kendo.Mvc.Extensions namespace.

Regards,
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jyotish
Top achievements
Rank 1
answered on 03 Jan 2017, 01:09 PM

Hi Team,

Could you please let me know where to find Kendo.Mvc.Extensions for asp.net MVC 5 existing project as I am unable to find the same.

0
Jyotish
Top achievements
Rank 1
answered on 03 Jan 2017, 01:34 PM
Got the solution, Thanks!!
0
Graham
Top achievements
Rank 2
Iron
Iron
answered on 13 Mar 2019, 10:15 AM
I got the error when I applied ToDatasourceResult after applying the Json method, and not before.
0
Alex Hajigeorgieva
Telerik team
answered on 15 Mar 2019, 06:29 AM
Hello, Graham,

Can you please provide a code snippet and a screenshot of the error? The expected syntax is as follows:

public ActionResult Orders_Read([DataSourceRequest]DataSourceRequest request)
{
    // where Orders is an IQueryable or IEnumerable
    var result = dataBase.Orders.ToDataSourceResult(request);
    return Json(result);
}

Kind Regards,
Alex Hajigeorgieva
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Graham
Top achievements
Rank 2
Iron
Iron
answered on 15 Mar 2019, 08:48 AM

Hello Alex,

 

I managed to get to the right order as shown in your post (apply ToDataSourceResult first, Json second). I posted so that next time I get the error, and my search leads me to this thread, I get the answer straight away.

 

Kind Regards,

Graham H. Laight

0
Chris
Top achievements
Rank 1
answered on 29 Mar 2019, 02:34 PM
Thanks for posting.  The comment about IQueryable or IEnumerable helped me.  I confirmed that I was using an IQueryable var.
Tags
Grid
Asked by
ShanthaKumar
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Jyotish
Top achievements
Rank 1
Graham
Top achievements
Rank 2
Iron
Iron
Alex Hajigeorgieva
Telerik team
Chris
Top achievements
Rank 1
Share this question
or