private void BindGridView(string index) { _invmstr.InvoiceId = Convert.ToInt16(index); _dt = _sobj.SelectInvoiceById(_invmstr); foreach (DataRow row in _dt.Rows) { lblInvoiceNo.Text = row["InvoiceNo"].ToString(); lblCustName.Text = row["CustomerName"].ToString(); lblCustAddress.Text = row["Address"].ToString(); lblCustMobileNo.Text = row["PhoneNo"].ToString(); lblInvoiceDate.Text = Convert.ToDateTime(row["CreatedDate"]).ToString("d MMMM, yyyy"); lblCustEmail.Text = row["EmailId"].ToString(); lblSubTotal.Text = row["SubTotalAmount"].ToString(); if (row["TaxName1"].ToString() == "") { lblTaxName1.Visible = false; lblTaxRate1.Visible = false; } else { lblTaxName1.Text = "Tax (" + row["TaxName1"].ToString() + " %):"; lblTaxRate1.Text = row["TaxRate1"].ToString(); } if (row["TaxName2"].ToString() == "") { lblTaxName2.Visible = false; lblTaxRate2.Visible = false; } else { lblTaxName2.Text = "Tax (" + row["TaxName2"].ToString() + " %):"; lblTaxRate2.Text = row["TaxRate2"].ToString(); } lblDiscount.Text = row["DiscountRate"].ToString(); lblAdditionCharge.Text = row["AdditionCharge"].ToString(); lblTotalAmount.Text = row["NetAmount"].ToString(); lblComment.Text = row["Comment"].ToString(); lblSalePersonName.Text = row["SalePersonName"].ToString(); if (row["PaymentStatus"].ToString() == "True") { lblPaymentStatus.Text = "Paid"; } else { lblPaymentStatus.Text = "UnPaid"; } } _invdtl.InvoiceId = Convert.ToInt16(index); _dt = _sobj.SelectInvoiceDetailById(_invdtl); gvItem.DataSource = _dt; gvItem.DataBind(); gvItem.Enabled = false; _invpay.InvoiceId = Convert.ToInt16(index); _dt = _sobj.SelectInvoicePaymentById(_invpay); foreach (DataRow row in _dt.Rows) { lblPaymentMethod.Text = row["PaymentMethod"].ToString(); lblPaymentMethod.Visible = true; lblPaymentMethodName.Visible = true; lblPayDate.Text = Convert.ToDateTime(row["PaymentDate"]).ToString("d MMMM, yyyy"); lblPayDateName.Visible = true; lblPayDate.Visible = true; if (row["CardNo"].ToString() == "") { lblCardName.Visible = false; lblCardNo.Visible = false; } else { lblCardName.Visible = true; lblCardNo.Visible = true; lblCardNo.Text = row["CardNo"].ToString(); } } }