protected void ddlAdvisorBranchList_SelectedIndexChanged(object sender, EventArgs e) { //ddlBranchRMList.Visible = false; bool groupHead = false; if (ddlAdvisorBranchList.SelectedIndex != 0) { string allCustomersId = Convert.ToString(GetSelectedCustomerIdString()); if (string.IsNullOrEmpty(allCustomersId)) { ddlAdvisorBranchList.SelectedIndex = 0; ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", "alert('Please select some customer for branch reassign');", true); return; } groupHead = advisorBranchBO.CheckCustomerGroupHead(allCustomersId); if (groupHead == true) { hndIsGroupHead.Value = "true"; } else { hndIsGroupHead.Value = "false"; } //if (groupHead == true) //{ // //ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "Pageloadscript", "window.confirm('The search fee will now be deducted for the criteria entered. Do you wish to continue?');", true); // //AjaxControlToolkit.ConfirmButtonExtender cbExt = new AjaxControlToolkit.ConfirmButtonExtender(); // //cbExt.ConfirmText // ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "confirm('Unable to locate your search item. Do you want to search the closest match from your item?');", true); //} DataTable dtRMList = advisorStaffBo.GetBranchRMList(int.Parse(ddlAdvisorBranchList.SelectedValue.ToString())); ddlBranchRMList.DataSource = dtRMList; ddlBranchRMList.DataTextField = dtRMList.Columns["RMName"].ToString(); ddlBranchRMList.DataValueField = dtRMList.Columns["AR_RMId"].ToString(); ddlBranchRMList.DataBind(); ddlBranchRMList.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select", "0")); foreach (GridDataItem dr in gvAssociations.Items) { int selectedRow = dr.ItemIndex + 1; int userId = int.Parse((gvAssociations.MasterTableView.DataKeyValues[selectedRow - 1]["UserId"].ToString())); int customerId = int.Parse((gvAssociations.MasterTableView.DataKeyValues[selectedRow - 1]["CustomerId"].ToString())); string rmId = gvAssociations.MasterTableView.DataKeyValues[selectedRow - 1]["RMId"].ToString(); int branchId = int.Parse((gvAssociations.MasterTableView.DataKeyValues[selectedRow - 1]["BranchId"].ToString())); if (((CheckBox)dr.FindControl("cbRecons")).Checked == true) { dtRMList.DefaultView.Sort = "AR_RMId"; int i = dtRMList.DefaultView.Find(rmId); if (i == (0 - 1)) { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", "alert('Some of the selected customer need to change RM also, please select the RM');", true); trReassignRM.Visible = true; } else { trReassignRM.Visible = false; } } } } }