Edit this page

Pass Additional Parameters to Custom DataSource

Environment

Product Progress Kendo UI Grid
Telerik UI for ASP.NET MVC 2017.3.1026

Description

I have a hierarchical Grid with a custom DataSource and a ClientHandlerDescriptor which is defined as described here.

How can I pass additional parameters to the ClientHandlerDescriptor?

Solution

  1. If you are using the ClientHandlerDescriptor for reading the data, define the JavaScript handler.

    .Transport(new
    {
        read = new Kendo.Mvc.ClientHandlerDescriptor() { HandlerName = "function(options) {customRead(options, '#=ID#')}" },
    })
    
  2. The customRead JavaScript handler will accept the default options argument as well as the ID of the parent Grid.

    function customRead(options, id) {
        $.ajax({
          method: "POST",
          url: '@Url.Action("ActionName", "ControllerName")',
          dataType: "json",
          data: {
            ID: id,
            // more data here
          },
          success: function(data) {
            options.success(data);
          }
        });
    }
    
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy