/// <summary>
    /// 绑定Grid
    /// </summary>
    protected void BindGrid()
    {
        UStockCheckDetail_JoeyBB stockCheckDetail_JoeyBB = new UStockCheckDetail_JoeyBB();
        DataSet ds = new DataSet();

        try
        {
            // this.StrWhere = "StockCheckBillNo = '"+this.tbStockCheckBillNo.Text.ToString().Trim()+"'";
            //string sql = "select * from vUStockCheckDetail_Joey  where StockCheckBillNo = '" + this.tbStockCheckBillNo.Text.ToString().Trim() + "'";

            string StockCheckBillNo = this.tbStockCheckBillNo.Text.ToString().Trim();
            string material = this.tbMaterial.Text.ToString().Trim();
            string boxno = this.tbBoxNo.Text.ToString().Trim();
            string wareNo = this.ddlWare.SelectedValue;
            string warelocatorNo = this.TextBox2.Text.ToString().Trim();
            string empNm = this.TextBox1.Text.ToString().Trim();
            string CheckResult = this.ddStockResult.SelectedValue;
            string strStartDt = "";
            string strEndDt = "";
            //开始盘点日期
            if (!string.IsNullOrEmpty(this.tbStockStartDt.Text.Trim()))
            {
                strStartDt = this.tbStockStartDt.Text.Trim().ToUpper();
            }

            //截止盘点日期
            if (!string.IsNullOrEmpty(this.tbStockEndDt.Text.Trim()))
            {
                strEndDt = this.tbStockEndDt.Text.Trim().ToUpper();
            }

            string sql = "exec [dbo].[Report_GetStcockResult]  '" + StockCheckBillNo + "','" + material + "','" + boxno + "','" + wareNo + "','" + warelocatorNo + "','" + empNm + "','" + CheckResult + "','" + strStartDt + "','" + strEndDt + "'";
            DataTable dt = SQLHelperDM.ExecuteDataSet(HS.Config.SqlDataObject.GetJoeyConnectionString, sql).Tables[0];

            this.grid.DataSource = dt;
            this.grid.DataBind();
            //赋值记录条数、页面总数
            this.Label3.Text = dt.Rows.Count.ToString();
            this.Label2.Text = this.grid.PageCount.ToString();
            this.currPage.Text = (this.grid.PageIndex + 1).ToString();
        }
        finally
        {
            stockCheckDetail_JoeyBB.Dispose();
        }
    }
    /// <summary>
    /// 删除
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDel_Click(object sender, EventArgs e)
    {
        bool retChecked = false;
        UStockCheckDetail_JoeyBB stockCheckDetail_JoeyBB = new UStockCheckDetail_JoeyBB();
        try
        {
            //获取选中的数据Id
            foreach (GridViewRow gvrow in this.grid.Rows)
            {
                CheckBox chkId = (CheckBox)gvrow.FindControl("chkId");
                if (chkId.Checked == true)
                {
                    retChecked = true;
                    int id = int.Parse(chkId.ValidationGroup);
                    stockCheckDetail_JoeyBB.DeleteRecord(id);
                }
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            stockCheckDetail_JoeyBB.Dispose();
        }

        if (retChecked)
        {
            this.BindGrid();
        }
    }