private void DepartmentBind(string campusname)
        {
            DataTable dtConfig = DataAccessManager.GetConfigration(campusname);

            if (dtConfig.Rows.Count > 0)
            {
                string connectionstring = string.Empty;
                connectionstring = dtConfig.Rows[0]["CampusConStr"].ToString();
                try
                {
                    DataTable dtCampus = new DataTable();
                    dtCampus                = DataAccessManager.Getdynamicdepartment(connectionstring);
                    RddlDept.DataSource     = dtCampus;
                    RddlDept.DataTextField  = "DeptDescription";
                    RddlDept.DataValueField = "DeptID";
                    RddlDept.DataBind();
                    RddlDept.Items[0].Text = "Select Departments";



                    RddlDept.SelectedIndex = 0;
                }
                catch (Exception ex)
                {
                    RddlDept.DataSource = null;
                    RddlDept.DataBind();
                }
            }
            else
            {
                RddlDept.DataSource = null;
                RddlDept.DataBind();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            RALPSwitchtoanthoruser.Visible = true;
            if (Session["pagename"] != null)
            {
                lbpagename.Text     = Convert.ToString(Session["pagename"]);
                lbpagename.CssClass = "additionalColumn";
            }
            if (!IsPostBack)
            {
                LBloginuser.Text = "<b>Current User:- </b>" + Convert.ToString(Session["username"]);



                #region Campus Logo
                imgCampusLogo.ImageUrl = "~/Content/clientlogo/" + Convert.ToString(Session["Campuslogo"]);
                #endregion

                if (Session["CampusID"] != null)
                {
                    RCBStudentsLeadSearch.Enabled  = true;
                    RBSelectStudent.Enabled        = true;
                    RBSelectLead.Enabled           = true;
                    RbtnRefreshApplication.Enabled = true;
                    #region "For all User Menu Bind"
                    string username = string.Empty, user_level = string.Empty;
                    username   = Convert.ToString(Session["username"]);
                    user_level = Convert.ToString(Session["user_level"]);

                    Menudt = DataAccessManager.UserMenuBind(user_level);
                    if (Menudt.Rows.Count > 0)
                    {
                        List <SiteDataItem> siteData = new List <SiteDataItem>();

                        DataRow[] MenuparentRow = Menudt.Select("ParentID='0'");


                        foreach (DataRow l_parentRow in MenuparentRow)
                        {
                            string text = string.Empty, url = string.Empty, id = string.Empty, parentId = string.Empty, MobileView = string.Empty;

                            text       = Convert.ToString(l_parentRow["Menu"]);
                            id         = Convert.ToString(l_parentRow["Menu_ID"]);
                            url        = Convert.ToString(l_parentRow["link"]);
                            parentId   = Convert.ToString(l_parentRow["parentId"]);
                            MobileView = Convert.ToString(l_parentRow["MobileView"]);
                            if (MobileView == "1")
                            {
                                MobileView = "additionalColumn";
                            }
                            else
                            {
                                MobileView = string.Empty;
                            }
                            if (parentId == "0")
                            {
                                siteData.Add(new SiteDataItem(Convert.ToInt32(id), null, text, url, MobileView));
                            }
                            else
                            {
                                siteData.Add(new SiteDataItem(Convert.ToInt32(id), Convert.ToInt32(parentId), text, url, MobileView));
                            }


                            DataRow[] MenuChildRow = Menudt.Select("ParentID='" + id + "' ");
                            if (MenuChildRow.Length > 0)
                            {
                                foreach (DataRow l_ChildRow in MenuChildRow)
                                {
                                    text       = string.Empty;
                                    url        = string.Empty;
                                    id         = string.Empty;
                                    parentId   = string.Empty;
                                    MobileView = string.Empty;
                                    text       = Convert.ToString(l_ChildRow["Menu"]);
                                    id         = Convert.ToString(l_ChildRow["Menu_ID"]);
                                    url        = Convert.ToString(l_ChildRow["link"]);
                                    parentId   = Convert.ToString(l_ChildRow["parentId"]);
                                    MobileView = Convert.ToString(l_ChildRow["MobileView"]);
                                    if (MobileView == "1")
                                    {
                                        MobileView = "additionalColumn";
                                    }
                                    else
                                    {
                                        MobileView = string.Empty;
                                    }
                                    if (parentId == "0")
                                    {
                                        siteData.Add(new SiteDataItem(Convert.ToInt32(id), null, text, url, MobileView));
                                    }
                                    else
                                    {
                                        siteData.Add(new SiteDataItem(Convert.ToInt32(id), Convert.ToInt32(parentId), text, url, MobileView));
                                    }
                                }
                            }
                        }
                        Session["menudata"] = siteData;
                        if (Session["menudata"] != null)
                        {
                            RMenuMain.DataTextField        = "Text";
                            RMenuMain.DataNavigateUrlField = "Url";
                            RMenuMain.DataFieldID          = "ID";
                            RMenuMain.DataValueField       = "ID";
                            RMenuMain.DataFieldParentID    = "ParentID";
                            RMenuMain.DataSource           = (List <SiteDataItem>)Session["menudata"];
                            RMenuMain.DataBind();
                        }


                        foreach (RadMenuItem item in RMenuMain.GetAllItems())
                        {
                            string text = item.Text;
                            string id   = Convert.ToString(item.Value);

                            DataRow[] MenuItemRow = Menudt.Select(" Menu_ID= '" + id + "' And MobileView=1");
                            if (MenuItemRow.Length > 0)
                            {
                                item.CssClass = "additionalColumn";
                            }



                            //
                        }
                    }
                    # endregion
                }
                if (Session["CampusID"] == null || Session["user_level"] == "99")
                {
                    RCBStudentsLeadSearch.Enabled  = false;
                    RBSelectStudent.Enabled        = false;
                    RBSelectLead.Enabled           = false;
                    RbtnRefreshApplication.Enabled = false;
                    #region "Menu Bind without Process by Admin"
                    string username = string.Empty, user_level = string.Empty;
                    username   = Convert.ToString(Session["username"]);
                    user_level = Convert.ToString(Session["user_level"]);

                    Menudt = DataAccessManager.UserMenuBind(user_level, "1");
                    if (Menudt.Rows.Count > 0)
                    {
                        List <SiteDataItem> siteData = new List <SiteDataItem>();

                        DataRow[] MenuparentRow = Menudt.Select("ParentID='0'");


                        foreach (DataRow l_parentRow in MenuparentRow)
                        {
                            string text = string.Empty, url = string.Empty, id = string.Empty, parentId = string.Empty, MobileView = string.Empty;

                            text       = Convert.ToString(l_parentRow["Menu"]);
                            id         = Convert.ToString(l_parentRow["Menu_ID"]);
                            url        = Convert.ToString(l_parentRow["link"]);
                            parentId   = Convert.ToString(l_parentRow["parentId"]);
                            MobileView = Convert.ToString(l_parentRow["MobileView"]);
                            if (MobileView == "1")
                            {
                                MobileView = "additionalColumn";
                            }
                            else
                            {
                                MobileView = string.Empty;
                            }
                            if (parentId == "0")
                            {
                                siteData.Add(new SiteDataItem(Convert.ToInt32(id), null, text, url, MobileView));
                            }
                            else
                            {
                                siteData.Add(new SiteDataItem(Convert.ToInt32(id), Convert.ToInt32(parentId), text, url, MobileView));
                            }


                            DataRow[] MenuChildRow = Menudt.Select("ParentID='" + id + "' ");
                            if (MenuChildRow.Length > 0)
                            {
                                foreach (DataRow l_ChildRow in MenuChildRow)
                                {
                                    text       = string.Empty;
                                    url        = string.Empty;
                                    id         = string.Empty;
                                    parentId   = string.Empty;
                                    MobileView = string.Empty;
                                    text       = Convert.ToString(l_ChildRow["Menu"]);
                                    id         = Convert.ToString(l_ChildRow["Menu_ID"]);
                                    url        = Convert.ToString(l_ChildRow["link"]);
                                    parentId   = Convert.ToString(l_ChildRow["parentId"]);
                                    MobileView = Convert.ToString(l_ChildRow["MobileView"]);
                                    if (MobileView == "1")
                                    {
                                        MobileView = "additionalColumn";
                                    }
                                    else
                                    {
                                        MobileView = string.Empty;
                                    }
                                    if (parentId == "0")
                                    {
                                        siteData.Add(new SiteDataItem(Convert.ToInt32(id), null, text, url, MobileView));
                                    }
                                    else
                                    {
                                        siteData.Add(new SiteDataItem(Convert.ToInt32(id), Convert.ToInt32(parentId), text, url, MobileView));
                                    }
                                }
                            }
                        }
                        Session["menudata"] = siteData;
                        if (Session["menudata"] != null)
                        {
                            RMenuMain.DataTextField        = "Text";
                            RMenuMain.DataNavigateUrlField = "Url";
                            RMenuMain.DataFieldID          = "ID";
                            RMenuMain.DataValueField       = "ID";
                            RMenuMain.DataFieldParentID    = "ParentID";
                            RMenuMain.DataSource           = (List <SiteDataItem>)Session["menudata"];
                            RMenuMain.DataBind();
                        }


                        foreach (RadMenuItem item in RMenuMain.GetAllItems())
                        {
                            string text = item.Text;
                            string id   = Convert.ToString(item.Value);

                            DataRow[] MenuItemRow = Menudt.Select(" Menu_ID= '" + id + "' And MobileView=1");
                            if (MenuItemRow.Length > 0)
                            {
                                item.CssClass = "additionalColumn";
                            }



                            //
                        }
                    }
                    # endregion
                }
                #region "Search Control"

                string SearchControlLeadId = string.Empty, SearchControlStudentNo = string.Empty;
                SearchControlLeadId    = Convert.ToString(Session["LeadId"]);
                SearchControlStudentNo = Convert.ToString(Session["StudentNo"]);
                if (SearchControlLeadId != string.Empty && SearchControlLeadId != null && SearchControlLeadId != "0")
                {
                    #region "Search Control Lead Setting"
                    RCBStudentsLeadSearch.WebServiceSettings.Method = "GetLeads";
                    RCBStudentsLeadSearch.HeaderTemplate            = new LeadHeaderTemplate();
                    RCBStudentsLeadSearch.Width         = 267;
                    RCBStudentsLeadSearch.DropDownWidth = 880;
                    RCBStudentsLeadSearch.EmptyMessage  = "Select a Lead";
                    RBSelectLead.Checked = true;
                    #endregion
                }
                if (SearchControlStudentNo != string.Empty && SearchControlStudentNo != null && SearchControlStudentNo != "0")
                {
                    #region "Search Control Student Setting"
                    RCBStudentsLeadSearch.WebServiceSettings.Method = "GetStudents";
                    RCBStudentsLeadSearch.HeaderTemplate            = new StudentHeaderTemplate();
                    RCBStudentsLeadSearch.Width         = 280;
                    RCBStudentsLeadSearch.DropDownWidth = 500;
                    RCBStudentsLeadSearch.EmptyMessage  = "Select a Student";
                    RBSelectStudent.Checked             = true;
                    #endregion
                }
                #endregion

                #region "departmentnamebind"

                /* Swtich Department */

                /* DataTable dtdept = DyDataAccessManager.GetListDepartment(DeptID);
                 * if (dtdept.Rows.Count > 0)
                 * {
                 *   LBDepartment.Text = "<b>Department:- </b>" + Convert.ToString(dtdept.Rows[0]["DeptDescription"]);
                 *
                 * }
                 * else
                 * {
                 *   LBDepartment.Text = "<b>Department:- </b>" + "Not Available";
                 * }*/

                int DeptID = 0;
                DeptID = Convert.ToInt32(Session["DeptID"]);
                DataTable dtDepartment = new DataTable();
                dtDepartment            = DyDataAccessManager.GetListDepartmentforswitch();
                RddlDept.DataSource     = dtDepartment;
                RddlDept.DataTextField  = "DeptDescription";
                RddlDept.DataValueField = "DeptID";
                RddlDept.DataBind();
                //RddlDept.Items[0].Text = "Select Departments";
                //RddlDept.SelectedIndex = 0;

                RddlDept.SelectedValue = Convert.ToString(DeptID);
                RddlDept.Enabled       = false;
                if (Convert.ToInt32(Session["AllowSwitchdept"]) == 1)
                {
                    RddlDept.Enabled = true;
                }
                #endregion
                #region "SMS Count"
                CountSMS();
                #endregion
            }
            string LeadId = string.Empty, StudentNo = string.Empty;
            LeadId    = Convert.ToString(Session["LeadId"]);
            StudentNo = Convert.ToString(Session["StudentNo"]);
            string type = string.Empty;
            if (StudentNo != string.Empty && StudentNo != null && StudentNo != "0")
            {
                StudentDetailBind();
            }
            if (LeadId != string.Empty && LeadId != null && LeadId != "0")
            {
                LeadDetailBind();
            }
        }