private void BindRMforBranchDropdown(int branchId, int branchHeadId)
        {
            try
            {
                if (advisorVo.A_AgentCodeBased != 1)
                {
                    DataSet ds = advisorBranchBo.GetAllRMsWithOutBMRole(branchId, branchHeadId);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        ddlAdviseRMList.DataSource     = ds.Tables[0];
                        ddlAdviseRMList.DataValueField = ds.Tables[0].Columns["RmID"].ToString();
                        ddlAdviseRMList.DataTextField  = ds.Tables[0].Columns["RMName"].ToString();
                        // ddlAdviseRMList.SelectedValue = "4682";
                        ddlAdviseRMList.DataBind();
                        //ddlAdviseRMList.Items.Remove("No RM Available");
                        //ddlAdviseRMList.Items.Insert(0, new ListItem("Select", "Select"));
                        //CompareValidator2.ValueToCompare = "Select";
                        //CompareValidator2.ErrorMessage = "Please select a RM";
                    }
                    else
                    {
                        if (!IsPostBack)
                        {
                            ddlAdviseRMList.Items.Insert(0, new ListItem("Select", "Select"));
                            CompareValidator2.ValueToCompare = "Select";
                            CompareValidator2.ErrorMessage   = "Please select a RM";
                        }
                        else
                        {
                            if (rbtnNonIndividual.Checked == true)
                            {
                                if ((IsPostBack) && (ddlAdviserBranchList.SelectedIndex == 0))
                                {
                                    ddlAdviseRMList.Items.Clear();
                                    ddlAdviseRMList.Items.Insert(0, new ListItem("Select", "Select"));
                                    CompareValidator2.ValueToCompare = "Select";
                                    CompareValidator2.ErrorMessage   = "Please select a RM";
                                }
                                else
                                {
                                    ddlAdviseRMList.Items.Clear();
                                    ddlAdviseRMList.Items.Remove("Select");
                                    ddlAdviseRMList.Items.Insert(0, new ListItem("No RM Available", "No RM Available"));
                                    CompareValidator2.ValueToCompare = "No RM Available";
                                    CompareValidator2.ErrorMessage   = "Cannot Add Customer Without a RM";
                                }
                            }
                            else
                            {
                                if ((IsPostBack) && (ddlAdviserBranchList.SelectedIndex == 0))
                                {
                                    ddlAdviseRMList.Items.Clear();
                                    ddlAdviseRMList.Items.Insert(0, new ListItem("Select", "Select"));
                                    CompareValidator2.ValueToCompare = "Select";
                                    CompareValidator2.ErrorMessage   = "Please select a RM";
                                }
                                else
                                {
                                    ddlAdviseRMList.Items.Clear();
                                    ddlAdviseRMList.Items.Remove("Select");
                                    ddlAdviseRMList.Items.Insert(0, new ListItem("No RM Available", "No RM Available"));
                                    CompareValidator2.ValueToCompare = "No RM Available";
                                    CompareValidator2.ErrorMessage   = "Cannot Add Customer Without a RM";
                                }
                            }
                        }
                    }
                }
                else
                {
                    DataSet Rmds = new DataSet();
                    //DataTable Rmlist = Rmds.Tables[0];
                    //Rmlist.Columns.Add("RmID");
                    //Rmlist.Columns.Add("RMName");
                    Rmds = advisorBranchBo.GetRMRoleForAgentBased(advisorVo.advisorId);

                    if (Rmds.Tables[0].Rows.Count > 0)
                    {
                        ddlAdviseRMList.DataSource     = Rmds;
                        ddlAdviseRMList.DataValueField = Rmds.Tables[0].Columns["RmID"].ToString();
                        ddlAdviseRMList.DataTextField  = Rmds.Tables[0].Columns["RMName"].ToString();
                        ddlAdviseRMList.DataBind();
                        ddlAdviseRMList.Enabled = false;
                    }
                    else
                    {
                        ddlAdviseRMList.Enabled = false;
                    }
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();

                FunctionInfo.Add("Method", "AdviserMFMIS.ascx:BindBranchDropDown()");

                object[] objects = new object[4];

                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }