This is a migrated thread and some comments may be shown as answers.

[Solved] Mixed binding grid, persist filters on form post

1 Answer 75 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ryan
Top achievements
Rank 2
Ryan asked on 06 Dec 2011, 08:43 PM
My scenario is I have a grid that is initially bound by server binding.  Any filtering, paging, sorting, or special client side filtering (from a form) is done with ajax binding.  This all works fine.

There is a Submit button that posts to a HttpPost action handler.  The problem I am running into is in this mixed mode the grid does not persist the filtering, orderby, or page number back to with the post.  The page size DOES persist on the post, but none of the rest. I need the additional properties of the grid.

Is this clear and is this supported?

Ryan Moore

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 09 Dec 2011, 01:11 PM
Hi Ryan,

Basically to persist the state of the Grid on post, you can use the client API of the Grid to get the properties representing the state and send them as route values to the controller.
e.g.

var grid = $("#grid").data("tGrid");
var orderBy = grid.orderBy;
var currentPage = grid.currentPage;
var filterBy = grid.filterBy;

Also you can take a look at this code library which shows how to preserve the grid state (paging, sorting, filtering and grouping) when navigating between pages.
I hope this helps.


Regards,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
Grid
Asked by
Ryan
Top achievements
Rank 2
Answers by
Petur Subev
Telerik team
Share this question
or