protected void grdMain_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "showdetail")
            {
                GridViewRow row            = (GridViewRow)((LinkButton)e.CommandSource).Parent.Parent;
                LinkButton  lnkBtnVchrType = (LinkButton)row.FindControl("lnkBtnVchrType");
                string      Vchr_Type      = lnkBtnVchrType.Text;
                HiddenField hidVchrIdno    = (HiddenField)row.FindControl("hidVchrIdno");
                int         Vchr_Idno      = Convert.ToInt32(hidVchrIdno.Value);
                HiddenField hidDoc         = (HiddenField)row.FindControl("hidDoc");
                int         HId            = Convert.ToInt32(hidDoc.Value);
                HiddenField hidVchrFrm     = (HiddenField)row.FindControl("hidVchrFrm");
                string      FTyp           = hidVchrFrm.Value.ToUpper();
                string      PageName       = string.Empty;

                if (string.IsNullOrEmpty(FTyp) == false)
                {
                    if (FTyp == "IB")
                    {
                        PageName = "Invoice.aspx?q=";
                    }
                    else if (FTyp == "ARIV")
                    {
                        PageName = "AmntAgainstInvoice.aspx?q=";
                    }
                    else if (FTyp == "CB")
                    {
                        PageName = "ChlnBooking.aspx?q=";
                    }
                    else if (FTyp == "FS")
                    {
                        PageName = "FuelSlip.aspx?FuelSlipIdno=";
                    }
                    else if (FTyp == "GR")
                    {
                        PageName = "GRPrep.aspx?Gr=";
                    }
                    else if (FTyp == "PTD")
                    {
                        PageName = "PaymentToOwn.aspx?q=";
                    }
                    else if (FTyp == "ACB")
                    {
                        PageName = "ChlnAmntPayment.aspx?q=";
                    }
                    else if (FTyp == "PB")
                    {
                        PageName = "PurchaseBill.aspx?PB=";
                    }
                    else if (FTyp == "SB")
                    {
                        PageName = "SaleBill.aspx?SbillIdno=";
                    }
                    if (string.IsNullOrEmpty(PageName) == false)
                    {
                        if (FTyp == "CB")
                        {
                            AccountBookDAL obj    = new AccountBookDAL();
                            var            lst    = obj.SelectChallanType(Convert.ToInt64(HId));
                            string         GRType = "";
                            if (lst != null)
                            {
                                GRType = Convert.ToString(lst.Gr_Type);
                                string url     = PageName + HId + "-" + GRType;
                                string fullURL = "window.open('" + url + "', '_blank' );";
                                ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true);
                            }
                        }
                        else if (FTyp == "IB")
                        {
                            AccountBookDAL obj    = new AccountBookDAL();
                            var            lst    = obj.SelectInvoiceType(Convert.ToInt64(HId));
                            string         GRType = "";
                            if (lst != null)
                            {
                                GRType = Convert.ToString(lst.Gr_Type);
                                string url     = PageName + HId + "-" + GRType;
                                string fullURL = "window.open('" + url + "', '_blank' );";
                                ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true);
                            }
                        }

                        else
                        {
                            string url     = PageName + HId;
                            string fullURL = "window.open('" + url + "', '_blank' );";
                            ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true);
                        }
                    }
                }
                else
                {
                    string url     = "VchrEntry.aspx?VchrIdno=" + HId;
                    string fullURL = "window.open('" + url + "', '_blank' );";
                    ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true);
                }
            }
        }