protected void ddlStepStatus_SelectedIndexChanged(object sender, EventArgs e) { PagedDataSource pds = new PagedDataSource(); pds.AllowPaging = true; list = taskManager.SelectAllNoStepTask(((UserInfo)Session["user"]).UID, Convert.ToInt32(ddlStepStatus.SelectedValue.Trim())); pds.PageSize = CommHelper.GetPageCount; pds.DataSource = list; pds.CurrentPageIndex = 0; //取得当前页索引 Pager2.DataCount = list.Count; //获取记录数 并赋值 Pager2.PageCount = pds.PageCount; GVShowTask.DataSourceID = null; GVShowTask.DataSource = pds; GVShowTask.DataBind(); }
/// <summary> /// 利用PagedDataSource做数据源绑定数据分页 /// </summary> /// <param name="pageIndex"></param> private void DataBind(int pageIndex) { PagedDataSource pds = new PagedDataSource(); pds.AllowPaging = true; pds.PageSize = CommHelper.GetPageCount; IList <Task> list = taskManager.SelectTaskByConditions(ddlYear.SelectedValue, ddlMonth.SelectedValue, ddlStatus.SelectedValue, ddlFile.SelectedValue); pds.DataSource = list; pds.CurrentPageIndex = pageIndex; //取得当前页索引 Pager2.DataCount = list.Count; //获取记录数 并赋值 Pager2.PageCount = pds.PageCount; GVShowTask.DataSourceID = null; GVShowTask.DataSource = pds; GVShowTask.DataBind(); }