In asp.net, how to do pagination
I have been asked more than once about how to implement paging functionality in ASP.net. I really do not want to answer this question.
Because in the asp.net to achieve pagination, it is too simple, simple to see the program will go to the gas jump, ah
Ah to publish sigh, why this dongdong not early out.
In the live web technology, we want to do pagination, often a long string of code to get it done, and each page
Face, it is necessary to rewrite once, annoying the deadly. But with the DataGrid control in ASP.net, our paging program can
Easy to handle, just need to make some settings for the DataGrid control. We are still using a program to see:
<% @ Page language= "C #"%>
<% @ Import namespace= "System.Data"%>
<% @ Import namespace= "System.Data.ADO"%>
<script language= "C #" runat= "Server" >
public void Page_Load (Object Src,eventargs E)
{
Join statement
String myConnString = "Driver={microsoft Access Driver (*.mdb)};
Dbq=c:/test/test.mdb; ";
String Strcomm = "SELECT * from userlist order by id";
Open a Join
ADOConnection myconnection = new ADOConnection (myConnString);
Open two DataSetCommand
Adodatasetcommand Mycomm = new Adodatasetcommand (strcomm,myconnection);
DataSet myDataSet = new DataSet ();
Save a userlist,booklist table in a dataset
Mycomm.filldataset (myDataSet, "userlist");
DataGrid1.DataSource = mydataset.tables["UserList"]. DefaultView;
Datagrid1.databind ();
}
</script>
<title></title>
<body>
<form runat= "Server" >
<asp:datagrid id= "DATAGRID1" runat= "Server"
Bordercolor= "BLACK"
Borderwidth= "1"
Gridlines= "Both"
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service