//绑定搜索到的学生数据到DataList protected void DataListBind() { tableHeader = this.GetTableHeader(); DalOperationAboutGradeCheck dos = new DalOperationAboutGradeCheck(); DataView dv = dos.SearchStudentsList(ddlSearchYear.SelectedValue, ddlSearchMajor.SelectedValue, ddlSearchSchoolClass.SelectedValue, txtKeyword.Text.Trim(),ddlGradeCheckLocale.SelectedValue,ddlGradeCheckDegree.SelectedValue).Tables[0].DefaultView; this.AspNetPager2.RecordCount = dv.Count; PagedDataSource pds = new PagedDataSource(); //定义一个PagedDataSource类来执行分页功 pds.DataSource = dv; pds.AllowPaging = true; pds.CurrentPageIndex = pageIndex - 1; pds.PageSize = CommonUtility.pageSize; this.dlSearchStudent.DataSource = pds; this.dlSearchStudent.DataBind(); if (pds.Count == 0) { this.dlSearchStudent.ShowFooter = true; } else { this.dlSearchStudent.ShowFooter = false; } }