Kendo
- Cannot read property '__count' of undefined Kendo UI Grid MVC Web API Odata
When trying to connect a Kendo UI Grid to an MVC Web API datasource I was getting the following error: Cannot read property ‘__count’ of undefined The problem is the format of the json being returned contains a value with the total number of records that can be used for paging. Solution is to add the following lines to your schema for the data source:
- Kendo MVC Grid Filter Expected primaryExpression
If you receive the error: Expected primaryExpression when trying to add a filter to the Kendo MVC grid then you have probably formatted it incorrectly. Try this: .DataSource(dataSource => dataSource .Ajax() .Filter(filters => filters.Add(trip => trip.DepartureDate).IsGreaterThanOrEqualTo(DateTime.Now.Date).And().IsLessThan(DateTime.Now.Date.AddDays(1))) .Model(model => model.Id(p => p.ID)) .Read(read => read.Action("GetTrips", "Trip")) )
- Kendo UI MVC Grid with Custom Calendar Filter
Here is my code for filtering a Kendo Grid using the Kendo Calendar control. Important things to note: The read method needs to accept a DataSourceRequest object. This will allow the filters you apply to the grid in JavaScript to be performed on the data you retrieve on the server side.
- Kendo UI MVC Grid DatePicker In-Line and In-Cell Edit Validation Error - The Value Is Not Valid
Errors:The value ‘Date Time’ is not valid for Field. If you are using the Kendo UI MVC grid with in-line or in-cell editing and you are using a culture that does not format the dates with the month first (eg en-US) you might encounter the above error when you enter a date over the 12th day because it will try to save the day as the month.
- How to add a checkbox to a Kendo UI MVC Grid
Ok took me a while to find this by piecing together information from various sources on the web. columns.Bound(p => p.Discontinued).ClientTemplate("<input type='checkbox' #= Discontinued ? checked='checked' : '' # ></input>") Do you agree with this solution? Do you know a better way? Please feel free to leave a comment and help us all in our quest for perfect code :-)