I miss an ordering functionality in the grid so I had to extend it using and extension method of HtmlHelper.
What I want to achieve
When a user comes to my grid, the url could be i.e.
and when the user clicks a link in the header to order the data in the gird then the URL could be changed to
In addition we should be able to inform the user about current ordering (asc,desc) and the user should have possibility to click the link to change the ordering in the header.
In short something like this:
Current MVCContrib doesn’t include such support so I added it.
I made an extension methods which you can you like in the following:
OrerbyLink extension methods have to check the current URL to see what’s the current ordering. It would be nicer if this would be part of some
interface as well as it is done with IPagination.
I think, it would be quite good if IPagination would be renamed to ICollectionModel which could contain both:
1) info about the pagination
2) info about the ordering
3) collection of the data itself
And then it would be good if there would be an easy way who to wrap the custom IEnumarable<T> to ICollectionModel. Propable using an extension method as it’s doen via AsPagination<T>().
The code can be downloaded from here
What do you think?