Jquery Post Request
Hi,
We are developing a few MVC controls and we have a problem - we are not able to get json data from MVC controller with jquery post request. After reading a few threads on this forum we have implemented a request (creating new route json/controller/action/id), but we have Ajax response and page content on the new page, but not in jquery success message (as stated in the code).
And there is also an issue with KendoUI grid - sorting by columns does not work. When clicking on sorting button we have a double redirection to one of the methods of MVC controller, as a result we have an empty grid (instead of having the sorted data in the grid)
Any help would be much appreciated.
Thanks,
Igor
Hi Igor,
The behavior you describe is indeed strange. Can you please present some code examples so we can try and reproduce the behavior?
Regards,
Ivan D. Dimitrov
Telerik
Hi Ivan,
Thanks for getting in touch. Below is the code shared by our developer. Can you please advice what we are doing wrong?
Thanks,
Igor
@model SitefinityWebApp.Mvc.Models.ClientsList
<
div
>
@(Html.Kendo().Grid((List<
SitefinityWebApp.Mvc.Models.ClientProfileModel
>)Model.clientScroll)
.Name("grid")
.Columns(columns =>
columns.Bound(c => c.ClientEntity.Name).Width(140);
columns.Bound(c => c.ClientEntity.HlImprovements).Width(190);
columns.Bound(c => c.UserProfile.LastModified);
columns.Bound(c => c.ClientEntity).Template(@<
a
href
=
"/createnewclient/clientprofile?guid=@item.ClientEntity.UserId"
>Client Info</
a
>);
)
//.HtmlAttributes(new style = "height: 380px;" )
.Scrollable()
.Sortable()
.Groupable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
)
</
div
>
Hi Igor,
Based on your view I cannot find any irregularities in the code. You could try debugging the application yourself and check whether your action is actually called and the json data is returned or the Kendo Grid is not binding correctly. Please, check the routing of the MVC controllers and the route, which is executed from the Grid query. Make sure you do not have duplicate routes or urls, which corresponds with urls of Sitefinity pages or items. I suggest testing the action methods with Fiddler and see what status code and result will the query return. Since, you are using post method, you could try sending an empty json instead of no data, if you have this scenario possible. However, I assume the issue is really coming from the configurations, so the above suggestions could help you investigate whether the problem comes from the controller's action, the routing, the Grid binding or something outside Sitefinity and Kendo configurations.
Additionally, if the above does not help, I can suggest you open a support ticket where you can send us the controls, or if necessary the entire project so that we can investigate this behavior in further depth.
Regards,
Ivan D. Dimitrov
Telerik