Can someone please have a look at the code and screen shots below and see
if you can give me some idea why the grid is blank after returning a valid collection
as part of a JsonResult?
Html.Kendo().Grid<AppointmentsDTO>().Name("FailedAppointments") .Columns(columns => { columns.Bound(o => o.MemberFirstName).Title("Member First").Width(80); columns.Bound(o => o.MemberLastName).Title("Member Last").Width(80); columns.Bound(o => o.ClientMemberID).Title("ClientID").Width(60); columns.Bound(o => o.ProviderID).Title("ProviderID").Width(60); columns.Bound(o => o.ProviderFirstName).Title("Provider First").Width(80); columns.Bound(o => o.ProviderLastName).Title("Provider Last").Width(100); columns.Bound(o => o.AppointmentDate).Title("Appointment Date").Width(200); columns.Bound(o => o.IHAAppointmentID).Hidden(true); }) .EnableCustomBinding(true) .AutoBind(true) .Pageable(page => page.Enabled(true).PageSizes(new Int32[] {20, 30, 50,100})) .Sortable(sorting => sorting.SortMode(Kendo.Mvc.UI.GridSortMode.SingleColumn)) .Selectable() .Scrollable(scroll => scroll.Height(350)) .DataSource(dataSource => dataSource .Ajax() .Read(read => read.Action("BindFailedAppointments", "AppointmentScheduling")))
13 Answers, 1 is accepted
for testing purpose : Can you please remove below selected property and check it?
If you have not added any key field then add it and check it.
Let me know if any concern.
Thanks,
Jayesh Goyani
The examples I seen here do not indicate that.
A GET request will be used by default if the kendo.aspnetmvc.js file is not included. It contains the MVC transport which applies some default options so that the wrappers will work as expected with MVC controllers and the Server API. The file missing would also explain why the Grid is not populated - an exception will be thrown for returning JSON without specifying the JsonRequestBehavior to allow GET.
The code that you shared looks correct. If this is not causing the problem, could you share a runnable sample so I can investigate further?
Daniel
the Telerik team
Btw, my experience has been that if things are not registered in the right order, kendo.aspnetmvc.js will break the grid if you use GET.
It's all very confusing in my opinion, and should be more clear in the examples. It seems to me that by providing this level a granularity in the script registeration process it causes more confusion than it helps. Developers who have already spent time learning Telerik MVC are not going to spend hours disecting hard to find documentation to find every little crack in the system.
We were close to ditching Kendo in favor of the old controls because of this issue. In Agile we just do not have time to mess around if something is too time consuming.
Thanks for the Help anyway...
Would you mind posting the js includes (in order)? I cant get the grid to populate either. If I send it all through the view's model I can bind it just fine, but if I switch to AJAX it comes up blank.
<link href="@Url.Content("~/Content/AdminVisualIdentity.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo.common.min.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo.default.min.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo.customblue.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery/jquery-1.8.2.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery/json2.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery/jquery.corner.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery/jquery.maskedinput-1.3.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/KendoUI/kendo.web.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/KendoUI/kendo.aspnetmvc.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/KendoUI/kendo.grid.min.js")" type="text/javascript"></script>
Use [HttpPost] on your Ajax method
Type the grid to the class that comprises your list, my data is a List<AppointmentsDTO>@(Html.Kendo().Grid<AppointmentsDTO>()....
Your DataSourceRequest object should have all the properties initialized,
check by clicking a column and checking the Sorts collection.
I walked back through the examples that you posted and discovered that my call to Entity Framework was returning type System.Data.Entity.DynamicProxies instead of the object type that I was specifying in the grid declaration. This seemed to be why the grid would not display the data.
To test my theory, I explicitly turned off the 'entities.Configuration.ProxyCreationEnabled = false' and it then returned the object type that I specified in the grid and walla...the data appeared.
Please check point 7 in below link for JS order.
http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/introduction#using-kendo-ui-in-aspnet-mvc-4-application
Thanks,
Jayesh Goyani
Q: why?
DataSourceResult result = Kendo.Mvc.Extensions.QueryableExtensions.ToDataSourceResult(model,request);
"It's all very confusing in my opinion, and should be more clear in the examples. It seems to me that by providing this level a granularity in the script registration process it causes more confusion than it helps. Developers who have already spent time learning Telerik MVC are not going to spend hours disecting hard to find documentation to find every little crack in the system."
Today the Kendo UI Grid ate up 5 hours of my time trying to refactor something the client had already had built in Telerik. The documentation on Kendo sucks. My Grid is still broken and a whole application feature is broken because of it. I moved to Kendo because Telerik was so well documented it was easy to find a solution to almost any problem.
I am really regretting the move to Kendo.
EDIT:
http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/ajax-editing
I mean really, come on, what kind of documentation is that, there is so many holes there. There is no depth, at least with the old telerik examples you included more descriptions, and included a model class as well. Really disappointing.
EDIT 2:
Additionally why don't you show the repository so we can at least reverse engineer what you have done. In your Examples your have a call to repository.All(). How am I supposed to know what is being returned from the repository? I am using entity framework, code first. DataSourceRequest what is that? Finally I want to state that I have searched every resource on Google and this site I could find while looking for an answer to this issue.
How do I avoid circular reference exceptions?
http://docs.kendoui.com/documentation/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/faq#how-do-i-avoid-circular-reference-exceptions?
same thing happening to my table . it is showing me the data for other table but not for one table.
MasterDataModel obj = new MasterDataModel ();
IEnumerable<MasterDataModel> entitlmentList = obj.GetEntitlementMasterRecords ();
=>DataSourceResult result = entitlmentList.ToDataSourceResult(request);
return Json (result, JsonRequestBehavior.AllowGet);
the line to which arrow is pointing to not works the control goes smwhere else frm that point.It is not binding list data to data source
please with any kind of soln u have...
Is there an exception thrown by the ToDataSourceResult method? If yes, then could you provide the exception message? If no, then could you provide a runnable sample that demonstrates the problem?
Regards,
Daniel
Telerik by Progress