protected void gvCustomerDetail_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow gvRow = (GridViewRow)((Button)e.CommandSource).NamingContainer; if (((Button)e.CommandSource).Text.Equals("Select")) { CustomerDetailsDAL oCustDetlDAL = new CustomerDetailsDAL(); CustomerDetails oCustDetl = new CustomerDetails(); oCustDetl.CustomerID = Convert.ToInt32(gvRow.Cells[1].Text); oCustDetl.isViewOnly = true; Result oResult = oCustDetlDAL.LoadOnlyMainByID(oCustDetl); if (oResult.Status) { CustomerDetail.SetCustomerDetails(oResult.Return as CustomerDetails); } } }