Recently, MVC uses paging, and finds a good paging control on the Internet. Thanks for the hard work of the author.
Download Pager
This paging control is also supported by Asp.net. You need to check the author's homepage.
Webdiyer
View the page chart
This is the simplest. This control also provides self-input jump and supports the selection of drop-down pages. Of course, I only use the simplest one. If you need to change it, please try to change it.
Now, check the view.Code
1 @ Using webdiyer. webcontrols. MVC 2 @ Model pagedlist <pagertest. Models. view_saleteachercours> 3 4 @{ 5 6 Layout =Null ; 7 } 8 <Table> 9 <Tr> 10 <TH> Course name </Th> 11 <TH> instructor name </Th> 12 </Tr> 13 @{ 14 15 Foreach ( VaR Item In Model) 16 { 17 <Tr> <TD> @ item. Name </TD> 18 <TD> @ item. Username </TD> 19 </Tr> 20 } 21 } 22 <Tr> 23 <TD> 24 @ Html. Pager (model, New Pageroptions {pageindexparametername = " ID " }) 25 </TD> 26 </Tr> 27 </Table> 28 <A> </a>
A simple O (∩ _ ∩) O is displayed.
Note that you need to use this control to define a pagedlist <> as shown in the first two rows.
@ Html. Pager (model,NewPageroptions {pageindexparametername ="ID"})
This directly generates pages, which is simple, fast, violent, and effective !!
Control:
1PublicActionresult index (Int?ID)2 {3Dbdatacontext DB =NewDbdatacontext ();4Pagedlist <view_saleteachercours> List = dB. view_saleteachercours.topagedlist (ID ??1,2);5 6ReturnView (list );7}
Just a few simple lines of data will pop up.
Well, it's simple, but I 'd like to share it with you in the simplest way.