分页问题~~不是很难,回答出来马上结帐 在线
这个是我写的 分页
Scon = new SqlConnection(ConfigurationSettings.AppSettings[ "Str_sql "]);
Sda = new SqlDataAdapter(sql_str, Scon);
Ds = new DataSet();
Sda.Fill(Ds);
Pds = new PagedDataSource();
Pds.DataSource = Ds.Tables[0].DefaultView;
Pds.AllowPaging = true;
Pds.PageSize = 5;
int CurPage;
if (System.Web.HttpContext.Current.Request.QueryString[ "Page "] != null)
CurPage = Convert.ToInt32(System.Web.HttpContext.Current.Request.QueryString[ "Page "]);
else
CurPage = 1;
Pds.CurrentPageIndex = CurPage - 1;
dqy = "当前页: " + CurPage.ToString();
ygy = "一共: " + Pds.PageCount.ToString();
sy = System.Web.HttpContext.Current.Request.AppRelativeCurrentExecutionFilePath + "?Page= " + Convert.ToString(1);
if (!Pds.IsFirstPage)
syy = System.Web.HttpContext.Current.Request.AppRelativeCurrentExecutionFilePath + "?Page= " + Convert.ToString(CurPage - 1);
if (!Pds.IsLastPage)
xyy = System.Web.HttpContext.Current.Request.AppRelativeCurrentExecutionFilePath + "?Page= " + Convert.ToString(CurPage + 1);
首页 我可以~~
sy = System.Web.HttpContext.Current.Request.AppRelativeCurrentExecutionFilePath + "?Page= " + Convert.ToString(1);
上一页 我可以
if (!Pds.IsFirstPage)
syy = System.Web.HttpContext.Current.Request.AppRelativeCurrentExecutionFilePath + "?Page= " + Convert.ToString(CurPage - 1);
if (!Pds.IsLastPage)
下一页 我可以