예제 #1
0
        /// <summary>
        /// 绑定数据源
        /// </summary>
        private void bind()
        {
            CommonBLL commBLL = new CommonBLL();

            DataTable dt = commBLL.getSemesterAttendaceRate(false);

            Label_attendRate.Text =dt.Rows.Count!=0? FormatUtil.doubleToPercent(CommonBLL.calculateAverageAttendRate(dt, "semesterAttendaceRate")):"0";

            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();
        }