I'm trying to use Telerik ASP.net MVC Grid, and find a problem.
When I use a grid in an ordinary View with Ajax binding, it works well. However, when I put the grid in a partial View that is loaded by an Ajax call, the grid's Ajax binding does not work then. From firebug, I find the ajax request for getting 开发者_开发技巧data did not send to server side.
I find a similar question in stackoverflow : Telerik MVC: Loading Grid with ajax request don't work , but don't find solution.
Thank you!
I also have same problem and i find the solution basically it is due to telerik javascript file.
<%: Html.Telerik().ScriptRegistrar().DefaultGroup(group => group.Combined(true).Compress(true)) %>
copay and paste that code In master page before end of the body or if you are not using master page then place it on every page where u use ajax binding of telerik .
the reason is I used ClientEvents
as below:
Html.Telerik().Grid(Model)
.....
.Selectable()
.ClientEvents(e => e.OnRowSelected("onRowSelected"))
and I put the js code of onRowSelected
handler after the grid.
When I move the js code of onRowSelected
before the grid, it works.
Try this in the OnSuccess event of the ajax call (in the AjaxOptions of the Ajax.ActionLink or Ajax.BeginForm)
OnSuccess = "function () {var html = $('#grid').html();$('#grid').html(html);}"
This force the ajax call for getting data.
精彩评论