/// <summary> /// 绑定数据源 /// </summary> private void bind() { string classID = Request.QueryString["classID"].ToString(); Label_className.Text = new ClassBLL().get(classID).Name; CommonBLL commBLL = new CommonBLL(); DataTable dt = commBLL.getClassStudentAttendStatistics(classID, null, true); 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(); }
public void bind() { string classID = Request.QueryString["classID"].ToString(); string courID = Request.QueryString["courId"].ToString(); //courseName.Text = new CourseBLL().get(courID).Name;//courseName改成className className.Text = new ClassBLL().get(classID).Name; User user = (User)Session["user"]; TeacherBLL teacherBll = new TeacherBLL(); Teacher teacher = teacherBll.getByUserId(user.Id); CommonBLL commBLL = new CommonBLL(); DataTable dt = commBLL.getClassStudentAttendStatistics(classID,teacher.Id, true); 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(); }
public void bind() { User user = (User)Session["user"]; ClassBLL classBLL = new ClassBLL(); StudentBLL studBll = new StudentBLL(); Student stud = studBll.getByUserId(user.Id); Class clazz = classBLL.get(stud.ClassID); className.Text = clazz.Name; CommonBLL commBLL = new CommonBLL(); DataTable dt = commBLL.getClassStudentAttendStatistics(clazz.Id, stud.Id, 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(); }