protected void Display(object sender, EventArgs e) { int rowIndex = Convert.ToInt32(((sender as LinkButton).NamingContainer as GridViewRow).RowIndex); // GridViewRow row = SaleStockTrans.Rows[rowIndex]; string id = SaleStockTrans.Rows[rowIndex].Cells[0].Text; string customer = SaleStockTrans.Rows[rowIndex].Cells[1].Text; CustName.Text = customer.ToString(); DataTable sale = stock.GetSalesReportDetail(id); GridView1.DataSource = sale as DataTable; GridView1.DataBind(); ClientScript.RegisterStartupScript(this.GetType(), "Pop", "openModal();", true); }