/// <summary> /// ��Grid /// </summary> protected void BindGrid() { HOrgnizationBB orgnizationBB = new HOrgnizationBB(); DataSet ds = new DataSet(); try { ds = orgnizationBB.GetVList(this.StrWhere); this.grid.DataSource = ds.Tables[0]; this.grid.DataBind(); //��ֵ��¼������ҳ������ this.Label3.Text = ds.Tables[0].Rows.Count.ToString(); this.Label2.Text = this.grid.PageCount.ToString(); this.currPage.Text = (this.grid.PageIndex + 1).ToString(); } finally { orgnizationBB.Dispose(); } }
/// <summary> /// 绑定数据源 /// </summary> private void BindGrid() { HOrgnizationBB deptBB = new HOrgnizationBB(); DataSet ds = new DataSet(); try { string strWhere = this.StrWhere; if (this.txtDepartNo.Text != "") { strWhere += " and departNo = '" + this.txtDepartNo.Text + "'"; } if (this.txtDepartNm.Text != "") { strWhere += " and departNm like '%" + this.txtDepartNm.Text + "%'"; } if (this.txtUppDepartNm.Text != "") { strWhere += " and uppDepartNm like '%" + this.txtUppDepartNm.Text + "%'"; } if (this.txtDepartLeaderNm.Text != "") { strWhere += " and leaderEmpNm like '%" + this.txtDepartLeaderNm.Text + "%'"; } ds = deptBB.GetVList(strWhere); this.grid.DataSource = ds.Tables[0]; this.grid.DataBind(); //赋值记录条数、页面总数 this.Label3.Text = ds.Tables[0].Rows.Count.ToString(); this.Label2.Text = this.grid.PageCount.ToString(); this.currPage.Text = (this.grid.PageIndex + 1).ToString(); } finally { deptBB.Dispose(); } }