/// <summary> /// 绑定Grid /// </summary> protected void BindGrid() { BBackBillBB backBillBB = new BBackBillBB(); DataSet ds = new DataSet(); try { string strWhere = this.StrWhere; if (this.txtTHBillNo.Text.Trim() != "") { strWhere += " and BackBillNo like '%" + this.txtTHBillNo.Text.Trim().Replace("'", "''") + "%'"; } //采购订单 if (this.tbFinanceBillNo.Text.Trim() != "") { strWhere += " and financeBillNo like '%" + this.tbFinanceBillNo.Text.Trim().Replace("'", "''") + "%'"; } //供应商 if (this.tbCust.Text.Trim() != "") { strWhere += " and (custNo like '%" + this.tbCust.Text.Trim().Replace("'", "''") + "%' or custNm like '%" + this.tbCust.Text.Trim().Replace("'", "''") + "%')"; } //物料 if (this.tbMaterial.Text.Trim() != "") { strWhere += " and (materialNo like '%" + this.tbMaterial.Text.Trim().Replace("'", "''") + "%' or materialDesc like '%" + this.tbMaterial.Text.Trim().Replace("'", "''") + "%')"; } //状态 if (this.ddlState.SelectedValue != "") { strWhere += " and instantState='" + this.ddlState.SelectedValue + "'"; } ds = backBillBB.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 { backBillBB.Dispose(); } }