public void bind() { User user = (User)Session["user"]; TeacherBLL teacherBll = new TeacherBLL(); Teacher teacher = teacherBll.getByUserId(user.Id); CommonBLL commonBll = new CommonBLL(); DataTable dt = commonBll.getAllRecordByRecordId(teacher.Id); 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(); }