Passing default filter, sort, and group values to a grid via QueryString URL paramaters

3 posts, 1 answers
  1. William
    William avatar
    1 posts
    Member since:
    Aug 2012

    Posted 28 Nov 2012 Link to this post


    I'm using (and loving) the KendoUI Complete for ASP.NET MVC.  I am trying to pass parameters to a page to indicate the filters, sorts, groups, etc. for the grid via the querystring; e.g., http://localhost/MyPage?sort=DatePlaced-desc&page=1&pageSize=15&group=&filter=Id~gte~1719300~and~Id~lte~1800000~and~UserFirstName~eq~'Edward'

    When these parameters are passed, I'm wanting the grid on the page to reflect these parameters when it gets created; i.e., the grid should be initially filtered by Id and UserFirstName in accordance with the filters passed to the page.

    I'm hoping for something as simple as:

        .DataSource(dataSource => dataSource
            .Read(read => read.Action("MyAction", "MyController"))

    I assume you get the idea of what I'm going for.  The motivation for this is as follows:  I'd like to give the user a few buttons, each to a different "canned" report, which is nothing more than the same grid with different filters, sorts, groups, etc.  So if the user clicked one of the buttons, they'd be taken to the page containing the grid, and the filters, sorts, etc. would be passed in as QueryString parameters.

    Your assistance on this would be much appreciated.

    Thank you,
    Billy McCafferty
  2. Daniel
    Daniel avatar
    2109 posts

    Posted 30 Nov 2012 Link to this post

    Hello Billy McCafferty,

    The Grid will automatically apply the state values if they are in the correct format - Grid Name +"-" + parameter name = value. For example if your Grid is named "Grid" - "http://localhost/MyPage?Grid-sort=DatePlaced-desc". You could also use your current parameters names but you will also need to use the PrefixUrlParameters to disable the prefix e.g.

    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Answer
    Chanaka avatar
    14 posts
    Member since:
    Jan 2012

    Posted 01 Jan 2013 Link to this post

    Take a look @ my Reply
    Do this 

    Grid Sorting,Filtering,Group Save

Back to Top