I am working in Telerik Grid.
My code for Grid – Onload is:
function OnLoad(e)
{
//$("#userSecurityGrid").data("tGrid").pageSize = 50;
$.post("@Url.Action("SetGridPageSize", "UserSecurity")")
}
My controller code looks like:
[GridAction]
[AcceptVerbs(HttpVerbs.Post)]
public int SetGridPageSize()
{
// to get grid page size value from table
// return value;
}
In the controller I will get the value from the table and I have to return to set the Page size.
I can set the grid page size value by
$("#userSecurityGrid").data("tGrid").pageSize
But, My question is that how I can return the value from the “SetGridPageSize” controller to the function “OnLoad” to assign the grid page size value.
Provide me a solution. Thanks.
You could pick up the return value and set pageSize in the $.post callback: