//private void BindListBranch(int rmId, string userType)
        //{
        //    UploadCommonBo uploadCommonBo = new UploadCommonBo();
        //    //DataSet ds = uploadCommonBo.GetAdviserBranchList(rmId, userType);
        //    DataSet dsAssociatedBranch=advisorBranchBo.GetRMBranchAssociation(rmVo.RMId, 0, "A");
        //    if (dsAssociatedBranch!=null && dsAssociatedBranch.Tables[0].Rows.Count > 0)
        //    {
        //        ddlAdviserBranchList.DataSource = dsAssociatedBranch.Tables[0];
        //        ddlAdviserBranchList.DataTextField = "AB_BranchName";
        //        ddlAdviserBranchList.DataValueField = "AB_BranchId";
        //        ddlAdviserBranchList.DataBind();
        //        ddlAdviserBranchList.Items.Insert(0, new ListItem("Select a Branch", "Select a Branch"));
        //    }
        //    else
        //    {
        //        ddlAdviserBranchList.Items.Insert(0, new ListItem("No Branches Available to Associate", "No Branches Available to Associate"));
        //        ddlAdviserBranchList_CompareValidator2.ValueToCompare = "No Branches Available to Associate";
        //        ddlAdviserBranchList_CompareValidator2.ErrorMessage = "Cannot Add Customer Without a Branch";
        //    }
        //}
        private void BindListBranch()
        {
            if (advisorVo.A_AgentCodeBased != 1)
            {
                UploadCommonBo uploadCommonBo = new UploadCommonBo();
                DataSet        ds             = uploadCommonBo.GetAdviserBranchList(advisorVo.advisorId, "adviser");
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    ddlAdviserBranchList.DataSource     = ds.Tables[0];
                    ddlAdviserBranchList.DataTextField  = "AB_BranchName";
                    ddlAdviserBranchList.DataValueField = "AB_BranchId";
                    //ddlAdviserBranchList.SelectedValue = "1339";
                    ddlAdviserBranchList.DataBind();
                    ddlAdviserBranchList.Items.Insert(0, new ListItem("Select", "Select"));
                }
                else
                {
                    ddlAdviserBranchList.Items.Insert(0, new ListItem("No Branches Available to Associate", "No Branches Available to Associate"));
                    ddlAdviserBranchList_CompareValidator2.ValueToCompare = "No Branches Available to Associate";
                    ddlAdviserBranchList_CompareValidator2.ErrorMessage   = "Cannot Add Customer Without a Branch";
                }
            }
            else
            {
                DataSet   BMDs   = new DataSet();
                DataTable BMList = new DataTable();
                //BMList.Columns.Add("AB_BranchId");
                //BMList.Columns.Add("AB_BranchName");
                BMDs = advisorBranchBo.GetBMRoleForAgentBased(advisorVo.advisorId);

                if (BMDs.Tables[0].Rows.Count > 0)
                {
                    ddlAdviserBranchList.DataSource     = BMDs;
                    ddlAdviserBranchList.DataValueField = BMDs.Tables[0].Columns["AB_BranchId"].ToString();
                    ddlAdviserBranchList.DataTextField  = BMDs.Tables[0].Columns["AB_BranchName"].ToString();
                    ddlAdviserBranchList.DataBind();
                    ddlAdviserBranchList.Enabled = false;
                }
                else
                {
                    ddlAdviseRMList.Enabled = false;
                }
            }
        }