思路:在读取数据表中的数据时无论读取多少行记录。我们最常用的是读取top N 到 topN+pageSize (通常按ID desc来取)。但分页有正序与倒序之分,具体怎么处理?先将代码粘出来,接下来再做详细说明。
引用网址:http://www.cnblogs.com/qyj0/archive/2009/11/11/1600959.html
protected void Store1_RefershData(object sender, StoreRefreshDataEventArgs e)
{
int Count = 0;
Hidden1.Text = e.Limit.ToString();
CheckLoad(ref Count, e.Start, e.Limit, int.Parse(groupID));
this.Store1.DataBind();
e.TotalCount = Count;
}
private void CheckLoad(ref int Count, int start, int limit, int groupID)
{
string uName = txt_user.Text != "" ? " and addUName like '%" + txt_user.Text + "%' " : "";
string title = txt_title.Text != "" ? " and title like '%" + txt_title.Text + "%' " : "";
string mark = ta_Mark.Text != "" ? " and content like '%" + ta_Mark.Text + "%' " : "";
ds = uD.Page_NumOut(limit, start, uName+title+mark+" and pass=1 and classID= " +groupID+"", 0, out Count);
if (ds != null && ds.Tables[0].Rows.Count > 0)
{
this.Store1.DataSource = ds; } else {
Count = 0;
this.Store1.DataSource = "";
}
}
#endregion RETURN @RecordCount
GO