Skip to content Skip to sidebar Skip to footer

How To Refresh Kendo Grid Base On Additional Paramer

I have a customize Read function for kendo grid .... public virtual async Task Read([DataSourceRequest] DataSourceRequest request, RecordStatus? recor

Solution 1:

So if you are using Kendo MVC UI you can use the Data property for the Read method of DataSource . So the client side method DataHandlerName will execute while you are requesting for the read action, by using-

    $('#Grid').data('kendoGrid').dataSource.read();

You can easily handle the client side script. Your Server Side code will be following for Kendo GRID,

    .DataSource(dataSource => dataSource.Ajax().ServerOperation(false).Read(r=> r.Action("ActionName","ControllerName").Type(HttpVerbs.Post).Data("DataHandlerName")))

And your client side code will be-

<script>functionDataHandlerName() {
         //your code will goes here var request={
                  id:1
                };
             return request ;
       }
   </script>

And Your Action Mehtod will be,

public ActionResult ActionName([DataSourceRequest] DataSourceRequest request,int id){}

Solution 2:

If I understood correctly you just need this. And also please take a look to the link. It may can helps you.

functiononSomeButtonClick(){
grid_.dataSource.read({q:"test"});

}

http://www.telerik.com/forums/how-to-refresh-a-grid-with-parameters-dc0f416ce08a

Solution 3:

Using Purely java script this is how you can send params to read method

$('#grid').data('kendoGrid').dataSource.Read({id:e.Id});$('#Grid').data('kendoGrid').refresh();

On Server Side you need this.

public ActionResult Products_Read([DataSourceRequest] DataSourceRequest request,int id){}

If you are using MVC based grid telerik forum already has example on how to do use read to send extra parameters .

http://www.telerik.com/forums/pass-additional-parameters-to-read-ajax-datasource-method---mvc

enter image description here

Post a Comment for "How To Refresh Kendo Grid Base On Additional Paramer"