I have following code in an old application that uses Telerik Grid. The ajax request to the server is always using POST. I need to change it to GET, but I can't find any documentation since it is an older version (not Kendo Grid, just Telerik Grid). Any ideas how to fix that?
Html.Telerik().Grid<GridDataRow>()
.Name("gridRecipientList")
.Columns(columns => ...)
.DataBinding(dataBinding =>
dataBinding.Ajax().Select("MyAction", "MyController"))
.Pageable(settings => ...)
.PrefixUrlParameters(false)
.EnableCustomBinding(true)
.Sortable(sorting => sorting
.SortMode(Telerik.Web.Mvc.UI.GridSortMode.SingleColumn)
.OrderBy(order=>order.Add(f=>f.P1)))
.Scrollable(settings => settings.Height(300))
.Resizable(resizing => resizing.Columns(true))
Posting the answer in hope that it helps someone else. I could define a client-side handler and explicitly set the verb used for read operation:
var onGridLoaded = function (e) {
var telerikGridData = $("div#gridRecords").data('tGrid');
if (telerikGridData != null) {
telerikGridData.ajax.options.transport.read.type = "GET";
}
};
And to bind the this function to the grid I added this to the server-side code above:
.ClientEvents(events => {
events.OnGridLoaded("onGridLoaded");
})