1

Closed

Sorting doesnt work when mutiple grids are on a page

description

If a page has multiple mvcContrib grids on it sorting is not supported on both since the sorting functionality relies on properties being named "column" and "direction". It would be good if these queryparam names we're configurable per grid so that the developer has control over the querystring and use column and direction properties per grid.
Closed May 15, 2010 at 1:13 PM by JeremyS
This is implemented in the latest commit.

There is now an overload for the grid's Sort method that allows you to specify a prefix as well as the GridSortOptions:

<%= Html.Grid(Model).AutoGenerateColumns().Sort((GridSortOptions)ViewData["sort"], "grid1") %>

With this in place, the links will render with arguments of grid1.Direction and grid1.Column.

In your controller action, this can be handled by applying the Bind attribute to the GridSortOptions argument:

public ActionResult Index([Bind(Prefix = "grid1")] GridSortOptions sort)

comments

dav_evans wrote May 15, 2010 at 1:47 PM

Great - thanks