コード例 #1
0
    /// <summary>
    /// 绑定Grid
    /// </summary>
    protected void BindGrid()
    {
        TSOutBillBB arriveBillBB = new TSOutBillBB();

        try
        {
            string strWhere = this.StrWhere;
            DataSet ds = new DataSet();

            //到货通知单编号
            if (txtBillNo.Text.Trim() != "")
            {
                strWhere += " and  tsOutBill like '%" + txtBillNo.Text.Replace("'", "''") + "%'";
            }

            //是否收货完成
            if (this.ddlIsFinishReceive.SelectedValue != "")
            {
                if (this.ddlIsFinishReceive.SelectedValue == "02")//生成拣货单
                {
                    strWhere += " and instantState = '02'";
                }
                else//没有生成拣货单
                {
                    strWhere += " and  instantState = '01'";
                }
            }

            ds = arriveBillBB.GetList(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
        {
            arriveBillBB.Dispose();
        }
    }