protected void GVViewDocBoy_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                BLDocBoyHistory bldb = new BLDocBoyHistory();
                int gvDocid;
                int intProjectId = int.Parse(Session["ProjectId"].ToString());
                System.Data.DataTable dt3 = new System.Data.DataTable();
                if (e.CommandName == "EditDocBoyHistory")
                {
                    GridViewRow gvr = (GridViewRow)((Control)e.CommandSource).NamingContainer;
                    int rowIndex = gvr.RowIndex;
                    //int DocBoyId = Conavert.ToInt32(GVViewDocBoy.Rows[rowIndex].Cells[1].Text);
                    int intDBHID = int.Parse(GVViewDocBoy.Rows[rowIndex].Cells[1].Text);
                    Session["DBHID"] = intDBHID;
                    SqlDataReader dr = bldb.getDBHistDetails1(intProjectId, intDBHID);
                    if (dr.HasRows)
                    {
                        while (dr.Read())
                        {
                            DateTime dtdate = dr.GetDateTime(1);
                            txtDate.Text = dtdate.ToShortDateString();
                            int intDocumentboyId = dr.GetInt32(2);
                            ddlSelDocBoy.SelectedItem.Text = dr.GetString(3);
                            txtRemarks.Text = dr.GetString(4);
                            DataTable dt = bldb.getSelectedUnSelectedDoc1(intProjectId, intDocumentboyId, dtdate, intDBHID);
                            GVSelPendingDoc.DataSource = dt;
                            GVSelPendingDoc.DataBind();
                            SqlDataReader dr1 = bldb.getSelDocFromDBHDetails1(intProjectId, intDocumentboyId, dtdate, intDBHID);
                            dt3.Columns.Add("Docid");
                            if (dr1.HasRows)
                            {
                                while (dr1.Read())
                                {
                                    int docid = dr1.GetInt32(0);
                                    dt3.Rows.Add(docid);
                                }
                            }
                            dr1.Close();
                        }
                        dr.Close();
                    }

                    foreach (GridViewRow gvrow in GVSelPendingDoc.Rows)
                    {
                        if (gvrow.RowType == DataControlRowType.DataRow)
                        {
                            gvDocid = int.Parse(gvrow.Cells[1].Text);
                            System.Web.UI.WebControls.CheckBox chksel = (gvrow.Cells[0].FindControl("ChkBxSelDoc") as System.Web.UI.WebControls.CheckBox);
                            for (int i = 0; i < dt3.Rows.Count; i++)
                            {
                                int doc = int.Parse(dt3.Rows[i].Field<string>(0));
                                if (doc == gvDocid)
                                {
                                    chksel.Checked = true;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                lblCatchError.Text = ex.Message.ToString();
            }
        }