/// <summary> /// 绑定数据源 /// </summary> private void bind() { string filter = "1=1 "; filter += DropDownList_class.SelectedValue.Equals("全院") ? "" : " and className='" + DropDownList_class.SelectedValue + "'"; filter += DropDownList_week.SelectedValue.Equals("全部周次") ? "" : " and week='" + DropDownList_week.SelectedValue + "'"; Label_className.Text = DropDownList_class.SelectedValue; Label_week.Text = DropDownList_week.SelectedValue; CommonBLL commBLL = new CommonBLL(); DataTable dt = PageUtil.getProcessedDataTable(commBLL.getWeekStudentAttendStatistics(false), 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(); }