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

Recovering grid state

4 Answers 213 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.
Akzhol The Kyrgyz
Top achievements
Rank 1
Akzhol The Kyrgyz asked on 07 Jun 2010, 08:37 AM
Hi, All

Assume following typical scenario: I select an item and click edit (not inline editing) button, this forwards me to edit page. After saving, I'm coming to Index.
But after coming to index, I want to recover the grid state. I mean I want the grid to be same sorting, filtering and paging applied.
How can we achieve this? Taking into account the fact that I've around 40-50 grids, what's the best way/place to save the state and the best way/place to recover it.

I'm using Server Binding in all places.


Thanks in advance Telerik Team and Atanas.

4 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 07 Jun 2010, 08:53 AM
Hi Akzhol The Kyrgyz,

You can use the extension method GridRouteValues(). To do so import the Telerik.Web.Mvc.Extensions. You can use it like this:

RouteValueDictionary routeValues = this.GridRouteValues();

where this is the instance of your controller class. Then you can use those route values in order to render an action link or to pass them to an action method.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Akzhol The Kyrgyz
Top achievements
Rank 1
answered on 09 Jun 2010, 02:27 PM
Hi, Atanas.
Thanks for you quick response and solution.
Just wanted to put my solution here, in case someone will need it. 
I just overrode RedirectToAction in my BaseController and added following lines:
  if (routeValues == null) 
                return base.RedirectToAction(actionName, controllerName, this.GridRouteValues()); 
            routeValues.AddRange(this.GridRouteValues()); 
            return base.RedirectToAction(actionName, controllerName, routeValues); 

So 4 lines of code solved problem in all 40-50 grids :).

Thanks again.

0
Binu
Top achievements
Rank 1
answered on 25 Oct 2010, 01:05 PM
If I am using Ajax Binding and I have ActionLinks for Edit, how do I pass gridroutevalues to my controller, Is GridRouteValues available for me when I am creating that Action Link?
0
Rafael
Top achievements
Rank 1
answered on 23 Nov 2010, 02:01 PM
Guys, who knows how it works for Ajax binding?
Tags
Grid
Asked by
Akzhol The Kyrgyz
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Akzhol The Kyrgyz
Top achievements
Rank 1
Binu
Top achievements
Rank 1
Rafael
Top achievements
Rank 1
Share this question
or