/// <summary> /// 绑定数据源 /// </summary> private void bind() { string studID = Request.QueryString["studID"].ToString(); CommonBLL commBLL = new CommonBLL(); DataTable dt = commBLL.getDetailStudentAttendStatistics(studID, false); AspNetPager1.RecordCount = dt.Rows.Count; int from = (AspNetPager1.CurrentPageIndex - 1) * AspNetPager1.PageSize + 1; int to = from + AspNetPager1.PageSize - 1 > AspNetPager1.RecordCount ? AspNetPager1.RecordCount : from + AspNetPager1.PageSize - 1; GridView1.DataSource = PageUtil.getPaged(dt, from, to); GridView1.DataBind(); }
/// <summary> /// 绑定数据源 /// </summary> private void bind() { string studID = Request.QueryString["studID"].ToString(); CommonBLL commBLL = new CommonBLL(); User user = (User)Session["user"]; TeacherBLL teacherBll = new TeacherBLL(); Teacher teacher = teacherBll.getByUserId(user.Id); string filter = "teacherID='" + teacher.Id + "'"; DataTable dt = PageUtil.getProcessedDataTable(commBLL.getDetailStudentAttendStatistics(studID, true), filter); AspNetPager1.RecordCount = dt.Rows.Count; int from = (AspNetPager1.CurrentPageIndex - 1) * AspNetPager1.PageSize + 1; int to = from + AspNetPager1.PageSize - 1 > AspNetPager1.RecordCount ? AspNetPager1.RecordCount : from + AspNetPager1.PageSize - 1; GridView1.DataSource = PageUtil.getPaged(dt, from, to); GridView1.DataBind(); }