cs页面调用代码:
代码如下:
public int TotalPage = 0;
public int PageCurrent = 1;
public int PageSize = 25;
public int RowsCount = 0;
string userid,username;
public DataTable dt = new DataTable();
public string path,userwelcome;
public string opt,cid;
protected void Page_Load(object sender,EventArgs e)
{
if (!IsPostBack)
{
if (Request.Params["page"] == null || Request.Params["page"].ToString().Equals(""))
PageCurrent = 1;
else
PageCurrent=int.Parse(Request.Params["page"].ToString());
this.getPage(out TotalPage,out RowsCount,PageSize,PageCurrent);
}
}
//调用存储过程的函数 private void getPage(out int totalPage,out int rowsCount,int pageSize,int currentPage)
{
sqlParameter[] parameters = {
new sqlParameter("@TotalPage",sqlDbType.Int,4),
new sqlParameter("@RowsCount",
new sqlParameter("@PageSize",
new sqlParameter("@CurrentPage",
new sqlParameter("@SelectFields",sqlDbType.NVarChar,700),
new sqlParameter("@IdField",50),
new sqlParameter("@OrderField",200),
new sqlParameter("@OrderType",2),
new sqlParameter("@TableName",300),
new sqlParameter("@strWhere",
};
parameters[0].Direction = ParameterDirection.Output;
parameters[1].Direction = ParameterDirection.Output;
parameters[2].Value = pageSize;
parameters[3].Value = currentPage;
parameters[4].Value = "a.RLId,a.companyName,a.webSite,a.isRL,a.ordernum,a.isrl,a.userid";
parameters[5].Value = "a.RLId"; parameters[6].Value = " a.isrl asc,a.orderNum ";
parameters[7].Value = "1";
parameters[8].Value = "qiYeRenling a";
parameters[9].Value = "1=1";// DataSet ds = Wm23Abc.DBUtility.DbHelpersql.RunProcedure("getRecordByPage",parameters,"dt");
dt = ds.Tables[0];
totalPage = int.Parse(parameters[0].Value.ToString());
rowsCount = int.Parse(parameters[1].Value.ToString());
}
.aspx页面代码:
public int PageCurrent = 1;
public int PageSize = 25;
public int RowsCount = 0;
string userid,username;
public DataTable dt = new DataTable();
public string path,userwelcome;
public string opt,cid;
protected void Page_Load(object sender,EventArgs e)
{
if (!IsPostBack)
{
if (Request.Params["page"] == null || Request.Params["page"].ToString().Equals(""))
PageCurrent = 1;
else
PageCurrent=int.Parse(Request.Params["page"].ToString());
this.getPage(out TotalPage,out RowsCount,PageSize,PageCurrent);
}
}
//调用存储过程的函数 private void getPage(out int totalPage,out int rowsCount,int pageSize,int currentPage)
{
sqlParameter[] parameters = {
new sqlParameter("@TotalPage",sqlDbType.Int,4),
new sqlParameter("@RowsCount",
new sqlParameter("@PageSize",
new sqlParameter("@CurrentPage",
new sqlParameter("@SelectFields",sqlDbType.NVarChar,700),
new sqlParameter("@IdField",50),
new sqlParameter("@OrderField",200),
new sqlParameter("@OrderType",2),
new sqlParameter("@TableName",300),
new sqlParameter("@strWhere",
};
parameters[0].Direction = ParameterDirection.Output;
parameters[1].Direction = ParameterDirection.Output;
parameters[2].Value = pageSize;
parameters[3].Value = currentPage;
parameters[4].Value = "a.RLId,a.companyName,a.webSite,a.isRL,a.ordernum,a.isrl,a.userid";
parameters[5].Value = "a.RLId"; parameters[6].Value = " a.isrl asc,a.orderNum ";
parameters[7].Value = "1";
parameters[8].Value = "qiYeRenling a";
parameters[9].Value = "1=1";// DataSet ds = Wm23Abc.DBUtility.DbHelpersql.RunProcedure("getRecordByPage",parameters,"dt");
dt = ds.Tables[0];
totalPage = int.Parse(parameters[0].Value.ToString());
rowsCount = int.Parse(parameters[1].Value.ToString());
}
.aspx页面代码:
排序值:<%= dt.Rows[i]["ordernum"].ToString() %> | 是否认领:<%=dt.Rows [i]["userid"].ToString () %> | " : ""%> |
第 <%=PageCurrent %> 页 共 <%=RowsCount %> 条 共 <%=TotalPage%> 页
<% if (PageCurrent != 1)
{
%>
<%
}
if (PageCurrent != TotalPage)
{
%>
<%
}
%>
<% if (PageCurrent != 1)
{
%>
<%
}
if (PageCurrent != TotalPage)
{
%>
<%
}
%>