关于分页的数据绑定
后台:
protected void btntime_Click(object sender, EventArgs e)
{
ddlsqlHelper sql = new ddlsqlHelper();
string sqlSel = "select ID,DepartmentID,PositionID,GradeLevel,SuggestSalary,RecuitingNum,RecuitingReasonType,CreateTime,T.G_CName as DepartmentName,T.GroupID,T1.GroupID,T1.G_CName as PositionName from sys_Anwerbeformular as B INNER JOIN sys_Group AS T ON B.DepartmentID=T.GroupID INNER JOIN sys_Group AS T1 ON B.PositionID = T1.GroupID where CreateTime between '" + txtstart.Text.ToString().Trim() + "' and '" + txtfinish.Text.ToString().Trim() + "'";
DataSet ds = sql.reDs(sqlSel);
UserList.DataSource = ds;
UserList.DataBind();
}
private void BindUserList()
{
PagedDataSource ps = new PagedDataSource();
ps.DataSource = Anwerbeformularbll.GetAnwerbeformular();
ps.AllowPaging = true; ps.PageSize = 10;
int CurPage;
if (Request.QueryString["Page"] != null && Request.QueryString["Page"] != "0")
{
CurPage = Convert.ToInt32(Request.QueryString["Page"]);
}
else
{
CurPage = 1;
}
ps.CurrentPageIndex = CurPage - 1;