protected void btnSubmitMoveFolio_Click(object sender, EventArgs e) { try { customerVo = (CustomerVo)Session["customerVo"]; CustomerPortfolioVo portfolioVo = new CustomerPortfolioVo(); CheckBox chkBox = new CheckBox(); chkBox = GetchkBox(); int accountID; int customerId = customerVo.CustomerId; int TofolioId = Convert.ToInt32(ddlPickPortfolio.SelectedValue); bool PortFolioUpdate; string statusMsg = string.Empty; foreach (GridDataItem dr in gvMFFolio.Items) { int selectedRow = 0; //int rowIndex = dr.RowIndex; //DataKey dKey = gvMFFolio.DataKeys[rowIndex]; if (((CheckBox)dr.FindControl("chkBox")).Checked == true) { AdvisorBranchBo adviserBranchBo = new AdvisorBranchBo(); accountID = Convert.ToInt32(gvMFFolio.MasterTableView.DataKeyValues[selectedRow]["FolioId"].ToString()); //string folioNo = gvMFFolio.MasterTableView.DataKeyValues[selectedRow]["FolioId"].ToString(); string folioNo = gvMFFolio.MasterTableView.Items[dr.ItemIndex].GetDataKeyValue("Folio No").ToString(); PortFolioUpdate = adviserBranchBo.FolioMoveToPortfolio(customerId, folioNo, TofolioId, accountID); if (PortFolioUpdate == true) { statusMsg = "Portfolio Moved to Another Portfolio"; statusMsgSuccess.InnerText = statusMsg; trFailure.Visible = true; statusMsgSuccess.Visible = true; statusMsgFailure.Visible = false; } else { statusMsgFailure.InnerText = statusMsg; statusMsg = "Portfolio Has not been moved"; trFailure.Visible = true; statusMsgSuccess.Visible = false; statusMsgFailure.Visible = true; } } } this.BindFolioGridView(); } catch (BaseApplicationException Ex) { throw Ex; } }