Example #1
0
        public static RadMenu CrearMenu(List <E_MENU> pLstMenu, bool pIsMobileDevice)
        {
            if (!pIsMobileDevice)
            {
                pLstMenu.Where(w => w.ID_MENU_PADRE.Equals(null)).ToList().ForEach(i => i.NB_MENU = (String.IsNullOrWhiteSpace(i.NB_IMAGEN)) ? i.NB_MENU : "&nbsp;");
            }

            RadMenu mModulo = new RadMenu()
            {
                DataFieldID          = "ID_MENU",
                DataFieldParentID    = "ID_MENU_PADRE",
                DataNavigateUrlField = "NB_URL",
                DataTextField        = "NB_MENU",
                RenderMode           = pIsMobileDevice ? RenderMode.Mobile : RenderMode.Classic,
                EnableRootItemScroll = true,
                CssClass             = "MenuPrincipal",
                OnClientItemClicking = "MenuItemClicked"
            };

            mModulo.DataBindings.Add(new RadMenuItemBinding()
            {
                ImageUrlField = "NB_IMAGEN",
                ToolTipField  = "NB_TOOLTIP"
            });

            mModulo.DataSource = pLstMenu;
            mModulo.DataBind();

            mModulo.Style.Add("float", "right");

            return(mModulo);
        }
 private void createmenuinside(DataTable dtMenuItem)
 {
     RadPanelItem newParentItem = new RadPanelItem();
     RadPanelItem newChildItem = new RadPanelItem();
     newParentItem.Text = dtMenuItem.Rows[0]["PROGRAM_TYPE_NAME"].ToString();
     newParentItem.Expanded = true;
     RadMenu myMenu = new RadMenu();
     myMenu.Width = Unit.Percentage(100);
     myMenu.Flow = ItemFlow.Vertical;
     myMenu.Skin = "Sitefinity";
     myMenu.EnableEmbeddedSkins =true;
     myMenu.DataTextField = "PROGRAM_SUB_NAME";
     myMenu.DataFieldID = "PROGRAM_SUB_ID";
     myMenu.DataFieldParentID = "PARENT_ID";
     myMenu.DataNavigateUrlField = "PROGRAM_NAME";
     myMenu.DataSource = dtMenuItem;
     myMenu.DataBind();
     newChildItem.Controls.Add(myMenu);
     newParentItem.Items.Add(newChildItem);
     RadPanelBar2.Items.Add(newParentItem);
     foreach (RadMenuItem myItems in myMenu.GetAllItems())
     {
         myItems.Width = Unit.Percentage(100);
     }
 }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RadMenu rd = (RadMenu)rdDBMenu;
            //TreeView tr = (TreeView)TreeView1;
            //SqlDataAdapter adapter = new SqlDataAdapter("select * from UserRoleMaster1", ConfigurationManager.ConnectionStrings["tspsecur_SMSConnectionString"].ConnectionString);
            //DataSet links = new DataSet();
            //adapter.Fill(links);
            //tr.DataSource = new HierarchicalDataSet(links,"userrole", "ParentId");
            ////TreeView1.DataSource = links;
            //tr.DataBind();
            SqlDataAdapter adapter = new SqlDataAdapter("select * from UserRoleMaster", ConfigurationManager.ConnectionStrings["tspsecur_SMSConnectionString"].ConnectionString);
            DataSet        links   = new DataSet();

            adapter.Fill(links);
            rd.DataTextField = "UserRole";
            //rd.DataNavigateUrlField = "NavigateUrl";
            rd.DataFieldID       = "ID";
            rd.DataFieldParentID = "ParentId";
            rd.DefaultGroupSettings.ExpandDirection.Equals("Down");//tried to change the direction OF FLOW OF MENU
            rd.DataSource = links;
            rd.DataBind();

            foreach (RadMenuItem rmi in rd.Items)
            {
                rmi.Attributes.Add("style", "cursor:pointer");
                foreach (RadMenuItem ci in rmi.Items)
                {
                    ci.Attributes.Add("style", "cursor:pointer");
                }
            }
        }
Example #4
0
        public static void BindToIEnumerable(RadMenu _menu)
        {
            List <menuitem> menuItem = new List <menuitem>();

            menuItem.Add(new menuitem(2, null, "Search Engines", ""));
            menuItem.Add(new menuitem(3, null, "News Sites", ""));
            menuItem.Add(new menuitem(4, 2, "Yahoo", "http://www.yahoo.com"));
            menuItem.Add(new menuitem(5, 2, "MSN", "http://www.msn.com"));
            menuItem.Add(new menuitem(6, 2, "Google", "http://www.google.com"));
            menuItem.Add(new menuitem(7, 3, "CNN", "http://www.cnn.com"));
            menuItem.Add(new menuitem(8, 3, "BBC", "http://www.bbc.co.uk"));
            menuItem.Add(new menuitem(9, 3, "FOX", "http://www.foxnews.com"));

            _menu.DataTextField        = "Text";
            _menu.DataNavigateUrlField = "Url";
            _menu.DataFieldID          = "ID";
            _menu.DataFieldParentID    = "ParentID";
            _menu.DataSource           = menuItem;
            _menu.DataBind();
        }
        private void LoadData()
        {
            Guid menuMasterId = new Guid();

            using (SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["PSCPortalConnectionString"].ConnectionString))
            {
                SqlCommand com = new SqlCommand {
                    Connection = con
                };
                con.Open();
                com.CommandType = CommandType.Text;
                com.Parameters.AddWithValue("@dataId", Portlet.PortletInstance.Id);
                com.CommandText = "Select MenuMasterId from PortletMenu Where DataId=@dataId";
                if (com.ExecuteScalar() != null)
                {
                    menuMasterId = new Guid(com.ExecuteScalar().ToString());
                }
            }
            RadMenu.DataSource = MenuCollection.GetMenuCollection(new MenuMaster {
                Id = menuMasterId
            }).GetBindingSource();
            RadMenu.DataBind();
        }
Example #6
0
        public void MenuBind(int User_Role)
        {
            log4net.ILog logger = log4net.LogManager.GetLogger("File");
            try
            {
                if (User_Role == 1)
                {
                    //SqlDataAdapter adapter = new SqlDataAdapter("select ID,DisplayText,NavigateUrl,ParentId from MenuMaster where ID != 119", ConfigurationManager.ConnectionStrings["tspsecur_SMSConnectionString"].ConnectionString);
                    SqlDataAdapter adapter = new SqlDataAdapter("select ID,DisplayText,NavigateUrl,ParentId from MenuMaster where ID != 119 and ID != 30 and ID != 65 and ID != 66 and ID != 31 and ID != 67 and ID != 68 and ID != 39 and ID != 46 and ID != 52 and ID != 48 and ID != 44 and ID != 112 and ID != 113 and ID != 125 and ID != 122 and ID != 123 and ID != 124 and ID != 24 and ID != 32 and ID != 69 and ID != 70 and ID != 71 and ID != 72 and ID != 73 and ID != 74 and ID != 75 and ID != 76 and ID != 42 and ID != 106 and ID != 107 and ID != 135 and ID != 36 and ID != 86 and ID != 87 and ID != 84 and ID != 131 and ID != 132 and ID != 140 and ID != 141 and ID != 115 and ID != 117 and ID != 118", ConfigurationManager.ConnectionStrings["tspsecur_SMSConnectionString"].ConnectionString);
                    DataSet        links   = new DataSet();
                    adapter.Fill(links);
                    rd.DataTextField        = "DisplayText";
                    rd.DataNavigateUrlField = "NavigateUrl";
                    rd.DataFieldID          = "ID";
                    rd.DataFieldParentID    = "ParentId";
                    rd.DefaultGroupSettings.ExpandDirection.Equals("Down");//tried to change the direction OF FLOW OF MENU
                    rd.DataSource = links;
                    rd.DataBind();

                    foreach (RadMenuItem rmi in rd.Items)
                    {
                        rmi.Attributes.Add("style", "cursor:pointer");
                        foreach (RadMenuItem ci in rmi.Items)
                        {
                            ci.Attributes.Add("style", "cursor:pointer");
                        }
                    }
                }

                /*else if (User_Role == 21)
                 * {
                 *  //-------------static permission has been given-------------------------------------------------------------------------------
                 *  //SqlDataAdapter adapter = new SqlDataAdapter("select ID,DisplayText,NavigateUrl,ParentId from MenuMaster where  ID=32 or ParentID = 32 or ParentID=69 or ParentID=70 or ID=33 or ID=35 or ParentID=35 or ParentID=84 or ID=36 or ParentID=36 or ID=42 or ParentID=42 union select MenuMaster.ID,DisplayText,NavigateUrl,MenuMaster.ParentId from MenuMaster,MenuMasterMap where MenuMaster.ID=MenuMasterMap.MenuId and MenuMasterMap.RoleId=" + User_Role + " and writepermission=" + 1 + " Order By MenuMaster.ID ASC", ConfigurationManager.ConnectionStrings["tspsecur_SMSConnectionString"].ConnectionString);
                 *  //=======================Changes:Sandeep Date:25/6========================================//
                 *  SqlDataAdapter adapter = new SqlDataAdapter("select ID,DisplayText,NavigateUrl,ParentId from MenuMaster where  ID=32 or ParentID = 32 or ParentID=69 or ParentID=70 or ID=33 or ID=35 or ParentID=35 or ParentID=84 or ID=36 or ParentID=36 or ID=42 or ParentID=42 union select MenuMaster.ID,DisplayText,NavigateUrl,MenuMaster.ParentId from MenuMaster,RoleMenuMap where MenuMaster.ID=RoleMenuMap.MenuId and RoleMenuMap.RoleId=" + User_Role + " Order By MenuMaster.ID ASC", ConfigurationManager.ConnectionStrings["tspsecur_SMSConnectionString"].ConnectionString);
                 *  //=============================================================//
                 *  DataSet links = new DataSet();
                 *  adapter.Fill(links);
                 *  rd.DataTextField = "DisplayText";
                 *  rd.DataNavigateUrlField = "NavigateUrl";
                 *  rd.DataFieldID = "ID";
                 *  rd.DataFieldParentID = "ParentId";
                 *  rd.DefaultGroupSettings.ExpandDirection.Equals("Down");//tried to change the direction OF FLOW OF MENU
                 *  rd.DataSource = links;
                 *  rd.DataBind();
                 *
                 *  foreach (RadMenuItem rmi in rd.Items)
                 *  {
                 *      rmi.Attributes.Add("style", "cursor:pointer");
                 *      foreach (RadMenuItem ci in rmi.Items)
                 *      {
                 *          ci.Attributes.Add("style", "cursor:pointer");
                 *      }
                 *  }
                 *  //adapter.Dispose();
                 *  //----------------------------------------------------------------------------------------------------------------
                 *  //------------dynamic permission set by superuser------------------------------------------------------------------------------
                 *  /*SqlDataAdapter adapter2 = new SqlDataAdapter("select MenuMaster.ID,DisplayText,NavigateUrl,MenuMaster.ParentId from MenuMaster,MenuMasterMap where MenuMaster.ID=MenuMasterMap.MenuId and MenuMasterMap.RoleId=" + User_Role + " and writepermission=" + 1 + " Order By MenuMaster.ID ASC", ConfigurationManager.ConnectionStrings["tspsecur_SMSConnectionString"].ConnectionString);
                 *  DataSet links2 = new DataSet();
                 *  adapter2.Fill(links2);
                 *  rd1.DataTextField = "DisplayText";
                 *  rd1.DataNavigateUrlField = "NavigateUrl";
                 *  rd1.DataFieldID = "ID";
                 *  rd1.DataFieldParentID = "ParentId";
                 *  rd1.DefaultGroupSettings.ExpandDirection.Equals("Down");//tried to change the direction OF FLOW OF MENU
                 *  rd1.DataSource = links2;
                 *  rd1.DataBind();
                 *
                 *  foreach (RadMenuItem rmi in rd1.Items)
                 *  {
                 *      rmi.Attributes.Add("style", "cursor:pointer");
                 *      foreach (RadMenuItem ci in rmi.Items)
                 *      {
                 *          ci.Attributes.Add("style", "cursor:pointer");
                 *      }
                 *  }
                 *  //-----------------------------------------------------------------------------------------------------------------------------
                 * }
                 *
                 * //==============Changes By Sandeep Date:27/6/2012======//
                 * /*
                 * else if ((User_Role == 8) || (User_Role == 16) || (User_Role == 6) || (User_Role == 17) || (User_Role == 19))
                 * {
                 *  rd = (RadMenu)rdDBMenu;
                 *  //=============================Changes:Sandeep Date:25/6=======================================================//
                 *  SqlDataAdapter adapter = new SqlDataAdapter("select MenuMaster.ID,DisplayText,NavigateUrl,MenuMaster.ParentId from MenuMaster,RoleMenuMap where MenuMaster.ID=RoleMenuMap.MenuId and RoleMenuMap.RoleId=" + User_Role + " Order By MenuMaster.ID ASC", ConfigurationManager.ConnectionStrings["tspsecur_SMSConnectionString"].ConnectionString);
                 *  //SqlDataAdapter adapter = new SqlDataAdapter("select MenuMaster.ID,DisplayText,NavigateUrl,MenuMaster.ParentId from MenuMaster,RoleMenuMap where ID=32 or ParentID = 32 or ParentID=69 or ParentID=70 and MenuMaster.ID=RoleMenuMap.MenuId and RoleMenuMap.RoleId=" + User_Role + " Order By MenuMaster.ID ASC", ConfigurationManager.ConnectionStrings["tspsecur_SMSConnectionString"].ConnectionString);
                 *  //SqlDataAdapter adapter = new SqlDataAdapter("select ID,DisplayText,NavigateUrl,ParentId from MenuMaster where  ID=32 or ParentID = 32 or ParentID=69 or ParentID=70  union select MenuMaster.ID,DisplayText,NavigateUrl,MenuMaster.ParentId from MenuMaster,RoleMenuMap where MenuMaster.ID=RoleMenuMap.MenuId and RoleMenuMap.RoleId=" + User_Role + " Order By MenuMaster.ID ASC", ConfigurationManager.ConnectionStrings["tspsecur_SMSConnectionString"].ConnectionString);
                 *  //===================================================================================//
                 *  DataSet links = new DataSet();
                 *  adapter.Fill(links);
                 *  rd.DataTextField = "DisplayText";
                 *  rd.DataNavigateUrlField = "NavigateUrl";
                 *  rd.DataFieldID = "ID";
                 *  rd.DataFieldParentID = "ParentId";
                 *  rd.DefaultGroupSettings.ExpandDirection.Equals("Down");//tried to change the direction OF FLOW OF MENU
                 *  rd.DataSource = links;
                 *  rd.DataBind();
                 *
                 *  foreach (RadMenuItem rmi in rd.Items)
                 *  {
                 *      rmi.Attributes.Add("style", "cursor:pointer");
                 *      foreach (RadMenuItem ci in rmi.Items)
                 *      {
                 *          ci.Attributes.Add("style", "cursor:pointer");
                 *      }
                 *  }
                 * }*/
                //======End Changes=====================//
                else
                {
                    rd = (RadMenu)rdDBMenu;
                    //=============================Changes:Sandeep Date:25/6/2012=======================================================//
                    //SqlDataAdapter adapter = new SqlDataAdapter("select MenuMaster.ID,DisplayText,NavigateUrl,MenuMaster.ParentId from MenuMaster,MenuMasterMap where MenuMaster.ID=MenuMasterMap.MenuId and MenuMasterMap.RoleId=" + User_Role + " and writepermission=" + 1 + " Order By MenuMaster.ID ASC", ConfigurationManager.ConnectionStrings["tspsecur_SMSConnectionString"].ConnectionString);
                    //SqlDataAdapter adapter = new SqlDataAdapter("select MenuMaster.ID,DisplayText,NavigateUrl,MenuMaster.ParentId from MenuMaster,RoleMenuMap where ID=32 or ParentID = 32 or ParentID=69 or ParentID=70 and MenuMaster.ID=RoleMenuMap.MenuId and RoleMenuMap.RoleId=" + User_Role + " Order By MenuMaster.ID ASC", ConfigurationManager.ConnectionStrings["tspsecur_SMSConnectionString"].ConnectionString);
                    //SqlDataAdapter adapter = new SqlDataAdapter("select ID,DisplayText,NavigateUrl,ParentId from MenuMaster where  ID=32 or ParentID = 32 or ParentID=69 or ParentID=70  union select MenuMaster.ID,DisplayText,NavigateUrl,MenuMaster.ParentId from MenuMaster,RoleMenuMap where MenuMaster.ID=RoleMenuMap.MenuId and RoleMenuMap.RoleId=" + User_Role + " Order By MenuMaster.ID ASC", ConfigurationManager.ConnectionStrings["tspsecur_SMSConnectionString"].ConnectionString);
                    //=============================Changes:Sandeep Date:28/6/2012===========================//
                    SqlDataAdapter adapter = new SqlDataAdapter("select MenuMaster.ID,DisplayText,NavigateUrl,MenuMaster.ParentId from MenuMaster,RoleMenuMap where MenuMaster.ID=RoleMenuMap.MenuId and RoleMenuMap.RoleId=" + User_Role + " Order By MenuMaster.ID ASC", ConfigurationManager.ConnectionStrings["tspsecur_SMSConnectionString"].ConnectionString);
                    //===================================================================================//
                    DataSet links = new DataSet();
                    adapter.Fill(links);
                    rd.DataTextField        = "DisplayText";
                    rd.DataNavigateUrlField = "NavigateUrl";
                    rd.DataFieldID          = "ID";
                    rd.DataFieldParentID    = "ParentId";
                    rd.DefaultGroupSettings.ExpandDirection.Equals("Down");//tried to change the direction OF FLOW OF MENU
                    rd.DataSource = links;
                    rd.DataBind();

                    foreach (RadMenuItem rmi in rd.Items)
                    {
                        rmi.Attributes.Add("style", "cursor:pointer");
                        foreach (RadMenuItem ci in rmi.Items)
                        {
                            ci.Attributes.Add("style", "cursor:pointer");
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                logger.Info(exc.Message);
            }
        }