protected void btnGo_Click(object sender, EventArgs e) { int i = 0; int isaAccountId = 0; if (ddlCustomerISAAccount.SelectedIndex != 0) { isaAccountId = int.Parse(ddlCustomerISAAccount.SelectedValue); } int CMFA_AccountId = 0; int AMCCode = 0; int IsJointlyHeld = 0; int PortfolioId = 0; string ModeOfHoldingCode = ""; bool result = false; foreach (GridDataItem gvRow in gvAvailableFolio.Items) { CheckBox chk = (CheckBox)gvRow.FindControl("cbRecons"); if (chk.Checked) { i++; } } if (i == 0) { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "alert('Please select a record!');", true); BindAvailableFolioGrid(int.Parse(txtCustomerId.Value), int.Parse(ddlCustomerISAAccount.SelectedValue)); } else { foreach (GridDataItem gdi in gvAvailableFolio.Items) { if (((CheckBox)gdi.FindControl("cbRecons")).Checked == true) { int selectedRow = gdi.ItemIndex + 1; CMFA_AccountId = Convert.ToInt32(gvAvailableFolio.MasterTableView.DataKeyValues[selectedRow - 1]["CMFA_AccountId"].ToString()); AMCCode = Convert.ToInt32(gvAvailableFolio.MasterTableView.DataKeyValues[selectedRow - 1]["PA_AMCCode"].ToString()); PortfolioId = Convert.ToInt32(gvAvailableFolio.MasterTableView.DataKeyValues[selectedRow - 1]["CP_PortfolioId"].ToString()); ModeOfHoldingCode = gvAvailableFolio.MasterTableView.DataKeyValues[selectedRow - 1]["XMOH_ModeOfHoldingCode"].ToString(); IsJointlyHeld = Convert.ToInt16(gvAvailableFolio.MasterTableView.DataKeyValues[selectedRow - 1]["CMFA_IsJointlyHeld"].ToString()); result = customerAccountBo.UpdateMFAccount(CMFA_AccountId, isaAccountId, AMCCode, PortfolioId, ModeOfHoldingCode, IsJointlyHeld); } } BindAttachedFolioGrid(isaAccountId); BindAvailableFolioGrid(int.Parse(txtCustomerId.Value), isaAccountId); } }