views:

85

answers:

1

Hello all,

Could you show me please the best methode to make pager fpr my asp.net mvc view? I have a typical table with posts, and they will be all showed at one time. If I have a 30 entries, i will preffer to show just 6 at the time. It will greate if I will have something like a menu to navigate ( like 1 - 2 - 3 ). It can be server side navigation i suppose.

Thanks a lot and take care, Ragims

+2  A: 

Use MvcContrib. It's got loads of useful stuff in the package apart from grid's and pagination.

The grid component has all sort of useful features, like sortable columns, autogenerating column names, from camelCase-d properties.

This tutorial should help you out a bit, i had a grid with pagination up and running within 5 minutes.

Update: Here's a better tutorial, and indeed subscribing to Michael Ceranski's RSS is well worth doing. He is using the repository pattern in his controller to get the data (which is good practice) but you could always swap that out for LINQ in your controller (not best practise).

Also see the Author of MVCcontrib's website for more info

If you don't want to use MVCContrib then there's the basic pagination class from Nerddinner

Doozer1979
I would like to have something without JQuery code.
Ragims
Mvccontrib by itself does not involve jquery. The writer of that article chose to use jquery to enable client side sorting and filtering. Give me half an hour to get to work and I'll dig out a better article.
Doozer1979