Introduction to using the ...asp.net urlpager control in the editor
1. Introduce urlpager. dll
2. Add in Web. config
3. register the route (in the Global File)
Using system. Web. Routing; // introduce the namespace
Call methods in application_start
Void application_start (Object sender, eventargs E)
{
Registerroutes (routetable. routes );
}
Compile a route Registration Method
Public static void registerroutes (routecollection routes)
{
Routes. mappageroute ("urlpagingrepeater ",
"{Controller}/{action}/Page _ {ID }",
"~ /Orderde. aspx ");
Routes. mappageroute ("urlpagingbasic ",
"Home/{pageindex }",
"~ /Default. aspx ");
}
4. mainly on the ASPX page
Introduce controls
Add controls
5. mainly in the CS File
Call the pagechanged event of the control to perform operations.
For example, Infos = orderinfo. searchorder (this. pager1.startrecordindex, this. pager1.endrecordindex );
6. At the beginning, you must write the stored procedure first.
Alter procedure [DBO]. [getorderpager]
@ Startindex int,
@ Endindex int
As
Begin
With orderlist (
Select row_number () over (order by orderid DESC) as row, * from [order]. orderinfo
Where 1 = 1
)
Select * From orderlist
Where row between @ startindex and @ endindex
End
Complete!