I'm trying to recreate a data grid that I've got working with the old MVC extensions, with the Kendo UI MVC extensions, but the documentation is virtually non-existent. Looking at the example, I've managed to get data into a grid, but it doesn't sort or filter (I'm not sure about apging, as there's only a few records at present.
The view is:-
and the controller is:-
How do I enable sorting and filtering?
Also, I had to add the AllowGet JsonRequestBehaviour, to get the grid to work. Your examples don't seem to require this - how?
Where is the documentation for the MVC extensions? I can only find a very brief (and very lacking!) migration overview, which fails to mention many of the server-side changes (no GridAction, the new DataSourceRequest etc..).
I'm keen to try out the new extensions, but without more documentation, it doesn't seem feasible.
18 Answers, 1 is accepted
The documentation can be found here: http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/introduction
the Telerik team
In fiddler, the request being fired is:- http://localhost:50793/UserMgmt/AjaxBinding?take=10&skip=0&page=1&pageSize=10&sort%5B0%5D%5Bfield%5D=UserName&sort%5B0%5D%5Bdir%5D=asc but no sort is taking place.
Again, filtering behaves the same way, the filter options are displayed, an ajax request is fired, but the data remains the same. An error seems to be generated when the filter (which isn't applied) is cleared, it generates the 'Object reference not set to an instance of an object.' error.
However, paging does seem to work.
The link you have posted is not to documentation, but just a brief guide, which hardlytouches the surface - it doesn't give details of the server side changes at all - a fairly major omission!
The documentation of the Kendo Grid for ASP.NET MVC can be found here: http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/overview
I am afraid I cannot reproduce the behavior you are seeing. I have created a sample project for you which shows a working implementation. What is different in your case?
the Telerik team
I finally found the cause - I had referenced the DataViz scripts as well.
After removing these, the grid functioned as expected.
Aren't the UI and data Viz components compatible?
Thanks for the documentation link - I'll bookmark it!
The Web and DataViz components are compatible. You however need to include kendo.all.min.js instead of kendo.web.min.js and kendo.dataviz.min.js if you want to use both. We will update the documentation to reflect that.Regards,
the Telerik team
I observe the similar problem:
Here is View part
In debug mode I see what Sorts and Filters equals NULL , whenever in firebug on client side I see all requested parameters(filters/sorts) correctly. Please see attached screen shots.
The same problem I receive also on Server binding like :
Where I'm wrong ?
I very confused , but i forgot to add it. Now It's work.
On the way:
I prefer to use Ajax binding. But I need OnCreate/Update redirect it to other page.
I read , what column template works only on Server binding.
Exists , some other ways to solve a problem (Server bind grid from my code example)
Thanks again and nice day
P.S. I solved it in following way :
I had the same problem as a few other people. The DataSourceRequest object was coming through with a NULL Sorts collection and the AJAX request was a GET instead of a POST.
I was using the new BundleConfig in MVC 4 and simply adding a script include for "~/Scripts/kendo*". The * was adding the scripts in alphabetic order, which in this scenario was wrong. Just something else to watch out for with MVC 4.
No matter what i do i can't get the Ajax updating to work properly. I have this error in my console
Uncaught TypeError: Object [object Object] has no method 'kendoGrid'
my bundle set up looks like this:
The gird displays, but does not load any data, but is styled correctly.
if i use it without ajax i still get this uncaught type error, but i can sort and load data just fine.
You probably have jQuery included twice.All the best,
the Telerik team
Remove this line:
@RenderSection("scripts", required: false)
And the ajax will start working again :)
I am using ASP.Net MVC 4 with Razor, and have used NuGet to update all standard packages that are included in a new MVC 4 project (this includes jQuery). I used NuGet to install KendoUI.
The data loads into the view just fine. But whenever I try a sort or filter, the results are unchanged. I would *like* for all of this to be done client-side (I get the data for the list when the page is loaded and would prefer not going back to the database at all). But if I need to go round-trips on these things, it's fine. I can keep the data in the controller if it needs to go back there.
I have already checked for multiple jquery refs -- don't have them. I have also checked for the aspnetmvc js file in the kendo folder -- it doesn't exist. I'm guessing it's been deprecated?
Here is the code in my _layout.cshtml to include the necessary scripts (I'm not including any twice): Here is my code for the view:
Here is my controller code:
I am probably missing something simple, but I can't see what it is. Any help is appreciated.