protected void btnEditSelectedWPTrans_Click(object sender, EventArgs e) { //int Id = 0; string panNumber = string.Empty; string tradeAccountNumber = string.Empty; string scripCode = string.Empty; string newScripCode = string.Empty; string exchange = string.Empty; string price = string.Empty; string newPrice = string.Empty; string transactionType = string.Empty; string newTransactionType = string.Empty; bool blResult = false; rejectedRecordsBo = new RejectedRecordsBo(); // Gets the footer row directly Cool right! GridViewRow footerRow = gvWERPTrans.FooterRow; string newPanNumber = ((TextBox)footerRow.FindControl("txtPanNumberMultiple")).Text; if (((TextBox)footerRow.FindControl("txtScripCodeMultiple")).Text != string.Empty) { newScripCode = ((TextBox)footerRow.FindControl("txtScripCodeMultiple")).Text; } string newExchange = ((TextBox)footerRow.FindControl("txtExchangeMultiple")).Text; if (((DropDownList)footerRow.FindControl("ddlTransactionType")).SelectedValue != "-1") { newTransactionType = ((DropDownList)footerRow.FindControl("ddlTransactionType")).SelectedValue; } if (((TextBox)footerRow.FindControl("txtPriceMultiple")).Text != string.Empty) { newPrice = ((TextBox)footerRow.FindControl("txtPriceMultiple")).Text; } foreach (GridViewRow dr in gvWERPTrans.Rows) { CheckBox checkBox = (CheckBox)dr.FindControl("chkBxWPTrans"); if (checkBox.Checked) { if (newPanNumber != "" || newScripCode != "" || newExchange != "" || newPrice != "" || newTransactionType != "") //Change this logic { panNumber = newPanNumber; scripCode = newScripCode; exchange = newExchange; transactionType = newTransactionType; price = newPrice; } else { panNumber = ((TextBox)dr.FindControl("txtPanNumber")).Text; if (((TextBox)dr.FindControl("txtScripCode")).Text != string.Empty) { scripCode = ((TextBox)dr.FindControl("txtScripCode")).Text; } exchange = ((TextBox)dr.FindControl("txtExchange")).Text; transactionType = ((DropDownList)dr.FindControl("ddlTransactionType")).SelectedValue; // price = Convert.ToDouble(((TextBox)dr.FindControl("txtPrice")).Text); price = ((TextBox)dr.FindControl("txtPrice")).Text; } int id = Convert.ToInt32(gvWERPTrans.DataKeys[dr.RowIndex].Value); blResult = rejectedRecordsBo.UpdateRejectedEquityTransactionStaging(id, panNumber, scripCode, exchange, price.ToString(), transactionType); } } if (blResult) { // Success Message } else { // Failure Message } // BindGrid if (Request.QueryString["processId"] != null) { ProcessId = Int32.Parse(Request.QueryString["processId"].ToString()); } BindEquityTransactionGrid(ProcessId); }