protected void btnSave_Click(object sender, EventArgs e) { trErrorMessage.Visible = false; string newPan = string.Empty; string newFolio = string.Empty; bool blResult = false; rejectedRecordsBo = new RejectedRecordsBo(); // Gets the footer row directly Cool right! GridViewRow footerRow = gvCAMSProfileReject.FooterRow; foreach (GridViewRow dr in gvCAMSProfileReject.Rows) { if (((TextBox)footerRow.FindControl("txtPanMultiple")).Text.Trim() == "" && ((TextBox)footerRow.FindControl("txtFolioMultiple")).Text.Trim() == "") { newPan = ((TextBox)dr.FindControl("txtPan")).Text; newFolio = ((TextBox)dr.FindControl("txtFolio")).Text; } else { newPan = ((TextBox)footerRow.FindControl("txtPanMultiple")).Text; newFolio = ((TextBox)footerRow.FindControl("txtFolioMultiple")).Text; } CheckBox checkBox = (CheckBox)dr.FindControl("chkBx"); if (checkBox.Checked) { int StagingId = Convert.ToInt32(gvCAMSProfileReject.DataKeys[dr.RowIndex].Values["MFFolioStagingId"].ToString()); int MainStagingId = Convert.ToInt32(gvCAMSProfileReject.DataKeys[dr.RowIndex].Values["MainStagingId"].ToString()); blResult = rejectedRecordsBo.UpdateMFFolioStaging(StagingId, MainStagingId, newPan, newFolio); } } if (blResult) { // Success Message } else { // Failure Message } // BindGrid if (Request.QueryString["processId"] != null) { ProcessId = Int32.Parse(Request.QueryString["processId"].ToString()); } if (Request.QueryString["filetypeid"] != null) { filetypeId = Int32.Parse(Request.QueryString["filetypeid"].ToString()); } BindGrid(ProcessId); }