thoughts on coding

March 6, 2009

Ordering in the MVCcontrib grid

Filed under: .NET, ASP.NET MVC, MVCContrib — Frantisek @ 2:53 pm

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,true

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?



  1. The download link doesn’t work. Can you please double check that? Thanks.

    Comment by Dan Miser — March 7, 2009 @ 1:17 am

    • Sorry, corrected. I cant upload the zip files to wordpress so I have to upload them to any free reliable storage server.


      Comment by Frantisek — March 7, 2009 @ 7:12 am

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Create a free website or blog at

%d bloggers like this: