문제

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

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top