Passing parameters to telerik asp.net mvc grid

Posted by GlobalCompe on Stack Overflow See other posts from Stack Overflow or by GlobalCompe
Published on 2010-04-06T17:49:24Z Indexed on 2010/04/06 17:53 UTC
Read the original article Hit count: 1359

Filed under:
|
|
|
|

I have a telerik asp.net mvc grid which needs to be populated based on the search criteria the user enters in separate text boxes. The grid is using ajax method to load itself initially as well as do paging.

How can one pass the search parameters to the grid so that it sends those parameters "every time" it calls the ajax method in response to the user clicking on another page to go to the data on that page?

I read the telerik's user guide but it does not mention this scenario. The only way I have been able to do above is by passing the parameters to the rebind() method on client side using jquery. The issue is that I am not sure if it is the "official" way of passing parameters which will always work even after updates. I found this method on this post on telerik's site: link text

I have to pass in multiple parameters. The action method in the controller when called by the telerik grid runs the query again based on the search parameters.

Here is a snippet of my code:

$("#searchButton").click(function() {
            var grid = $("#Invoices").data('tGrid');

            var startSearchDate = $("#StartDatePicker-input").val();
            var endSearchDate = $("#EndDatePicker-input").val();

            grid.rebind({ startSearchDate: startSearchDate ,
                          endSearchDate: endSearchDate
                      });

        }

        );

© Stack Overflow or respective owner

Related posts about telerik

Related posts about asp.net-mvc