private void BindDetailData(string id, int pageIndex = 1) { DataTable dt = new DataTable(); string allTiaoshu = dtrowsHidden.Value.ToString(); //获取到所有的条数 int alltiaoshuInt = int.Parse(allTiaoshu); dt = pageControl.GetList_FenYe_Common(" BudgetId=" + id, pageIndex, GV_Summary.PageSize, alltiaoshuInt, "vBudget_User_Apply", "AddTime").Tables[0]; pageIndex = pageControl.pageindex(pageIndex, GV_Summary.PageSize, alltiaoshuInt); //获取当前要显示的页码数【如果最后一页的最后一条记录被删除后,还能正常显示】 if (dt.Rows.Count > 0) { string rowNumberCol = "PX"; dt.Columns.Add(rowNumberCol, typeof(string)); for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i][rowNumberCol] = i + 1; } GV_Details.Visible = true; GV_Details.DataSource = dt; GV_Details.DataBind(); LB_MSG.Text = ""; pageControl.SetSelectPage(pageIndex, int.Parse(dtrowsHidden.Value.ToString()), DDL_ToPage, GV_Details.PageSize, FirstPage, NextPage, PreviousPage, LastPage, Label_showInfo); //加载通用组件里面的分页函数 pageControlShow.Visible = true; //如果记录集不为空,则显示分页控件 } else { GV_Details.Visible = false; notice.Text = "该预算经费暂无记帐的操作记录!"; } }
/// <summary> ///显示待审核的项目列表信息 /// </summary> /// <param name="pageindex"></param> protected void ShowListInfo(int pageindex) { try { DataTable DT = new DataTable(); Model.USER_Users user_model = (Model.USER_Users)Session["USER_Users"]; string sqlWhere1 = string.Format(" CHARINDEX('{0}', ManagerIDs)> 0 or CHARINDEX('{1}', ParentManagerIDs)> 0", user_model.ID, user_model.ID); //string role = Request["role"].ToString(); string allTiaoshu = dtrowsHidden.Value.ToString(); //获取到所有的条数 int alltiaoshuInt = int.Parse(allTiaoshu); DT = pageControl.GetList_FenYe_Common(sqlWhere1, pageindex, GridView1.PageSize, alltiaoshuInt, "vBudget_Child_List", "ADDTIME").Tables[0]; pageindex = pageControl.pageindex(pageindex, GridView1.PageSize, alltiaoshuInt); //获取当前要显示的页码数【如果最后一页的最后一条记录被删除后,还能正常显示】 if (DT.Rows.Count > 0) { //当获取到的数据集不为空的时候,显示在GridView1中 GridView1.Visible = true; GridView1.DataSource = DT; //指定GridView1的数据是DT pageindexHidden.Value = pageindex.ToString(); //给隐藏的页码变量赋值,给下面的分页控件提供数据 GridView1.DataBind(); //将上面指定的信息绑定到GridView1上 //Button_check.Enabled = true; //Button_checkfalse.Enabled = true; tag.Text = ""; pageControl.SetSelectPage(pageindex, int.Parse(dtrowsHidden.Value.ToString()), DropDownList2, GridView1.PageSize, FirstPage, NextPage, PreviousPage, LastPage, Label_showInfo); //加载通用组件里面的分页函数 notice.Text = ""; pageControlShow.Visible = true; //如果记录集不为空,则显示分页控件 } else { GridView1.Visible = false; notice.Text = "*没有符合条件的结果!"; pageControlShow.Visible = false; //如果记录集为空,则不显示分页控件 //Button_check.Enabled = false; //Button_checkfalse.Enabled = false; if (alltiaoshuInt > 0) { ShowListInfo(pageindex - 1); } } } catch (Exception e) { } }