当前位置: 首页>>代码示例>>C#>>正文


C# MenuItemCollection.Add方法代码示例

本文整理汇总了C#中System.Web.UI.WebControls.MenuItemCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# MenuItemCollection.Add方法的具体用法?C# MenuItemCollection.Add怎么用?C# MenuItemCollection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.WebControls.MenuItemCollection的用法示例。


在下文中一共展示了MenuItemCollection.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PopulateNodes

        private void PopulateNodes(DataTable dt, MenuItemCollection items)
        {
            foreach (DataRow dr in dt.Rows)
            {
                MenuItem mi = new MenuItem();

                mi.Text = dr["menu"].ToString();
                mi.Value = dr["menuid"].ToString();
                mi.NavigateUrl = dr["url"].ToString();
                items.Add(mi);
                //If node has child nodes, then enable on-demand populating
                bool flag = ((int)(dr["childnodecount"]) > 0);
                if (flag)
                {
                    menuCreate(mi);
                }
            }
        }
开发者ID:tianhang,项目名称:SA39_AD,代码行数:18,代码来源:Site.Master.cs

示例2: PrepareLyncMenu

        private void PrepareLyncMenu(MenuItemCollection lyncItems)
        {
            lyncItems.Add(CreateMenuItem("LyncUsers", "lync_users", @"Icons/lync_users_48.png"));

            //if (ShortMenu) return;

            lyncItems.Add(CreateMenuItem("LyncUserPlans", "lync_userplans", @"Icons/lync_userplans_48.png"));


            if (Utils.CheckQouta(Quotas.LYNC_FEDERATION, Cntx))
                lyncItems.Add(CreateMenuItem("LyncFederationDomains", "lync_federationdomains", @"Icons/lync_federationdomains_48.png"));

            if (Utils.CheckQouta(Quotas.LYNC_PHONE, Cntx))
                lyncItems.Add(CreateMenuItem("LyncPhoneNumbers", "lync_phonenumbers", @"Icons/lync_phonenumbers_48.png"));
        }
开发者ID:JohnyBuchar,项目名称:Websitepanel,代码行数:15,代码来源:OrganizationMenuControl.cs

示例3: PrepareOCSMenu

 private void PrepareOCSMenu(MenuItemCollection osItems)
 {
     osItems.Add(CreateMenuItem("OCSUsers", "ocs_users"));
 }
开发者ID:JohnyBuchar,项目名称:Websitepanel,代码行数:4,代码来源:OrganizationMenuControl.cs

示例4: LoadCmsMenu

        private void LoadCmsMenu(MenuItemCollection itemCollection)
        {
            const string CmsPagePath = "~/Cms/Default.aspx";

            // Show the CMS links by Id and by Slug.
            var byIdItem = new MenuItem("Pages by Id", "cms-pages-by-id") {
                Selectable = false
            };
            var bySlugItem = new MenuItem("Pages by Slug", "cms-pages-by-slug") {
                Selectable = false
            };

            // Load the CMS content document.
            var cmsContent = new XPathDocument(MapPath("~/App_Data/CmsContent.xml"));
            var navigator = cmsContent.CreateNavigator();

            // Get any matching page node.
            var pageNodes = navigator.Select("/pages/page[@id][@slug]");
            while (pageNodes.MoveNext()) {
                var pageId = int.Parse(pageNodes.Current.GetAttribute("id", string.Empty));
                var pageSlug = pageNodes.Current.GetAttribute("slug", string.Empty);
                var pageTitle = pageNodes.Current.GetAttribute("title", string.Empty);

                byIdItem.ChildItems.Add(new MenuItem(pageTitle,
                                                     string.Format("cms-page-id-{0}", pageId),
                                                     null,
                                                     CmsPagePath + GenerateRandomQueryParameters("pageId", pageId.ToString())));
                bySlugItem.ChildItems.Add(new MenuItem(pageTitle,
                                                       string.Format("cms-page-slug-{0}", pageSlug),
                                                       null,
                                                       CmsPagePath + GenerateRandomQueryParameters("pageSlug", pageSlug)));
            }

            // Add the new items to the collection, if any CMS pages were found.
            if (byIdItem.ChildItems.Count > 0) {
                itemCollection.Add(byIdItem);
                itemCollection.Add(bySlugItem);
            }
        }
开发者ID:frenzypeng,项目名称:securityswitch,代码行数:39,代码来源:SiteMap.ascx.cs

示例5: GetIconsDataSource

        public MenuItemCollection GetIconsDataSource(int packageId)
        {
            // load package context
            PackageContext cntx = PackagesHelper.GetCachedPackageContext(packageId);

            // init collection
            MenuItemCollection items = new MenuItemCollection();

            // get icons list
            foreach (XmlNode xmlNode in xmlIcons)
            {
                // create icon item
                MenuItem iconItem = CreateMenuItem(cntx, xmlNode);
                if (iconItem == null)
                    continue;

                // add into list
                items.Add(iconItem);
            }

            return items;
        }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:22,代码来源:UserSpaces.ascx.cs

示例6: FillBoundChildrenRecursive

		void FillBoundChildrenRecursive (IHierarchicalEnumerable hEnumerable, MenuItemCollection itemCollection)
		{
			if (hEnumerable == null)
				return;
			foreach (object obj in hEnumerable) {
				IHierarchyData hdata = hEnumerable.GetHierarchyData (obj);
				MenuItem item = new MenuItem ();
				itemCollection.Add (item);
				item.Bind (hdata);

				SiteMapNode siteMapNode = hdata as SiteMapNode;
				if (siteMapNode != null) {
					if (_currSiteMapNode == null)
						_currSiteMapNode = siteMapNode.Provider.CurrentNode;
					if (siteMapNode == _currSiteMapNode)
						item.Selected = true;
				}
				
				OnMenuItemDataBound (new MenuEventArgs (item));

				if (hdata == null || !hdata.HasChildren)
					continue;

				IHierarchicalEnumerable e = hdata.GetChildren ();
				FillBoundChildrenRecursive (e, item.ChildItems);
			}
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:27,代码来源:Menu.cs

示例7: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            ShortMenu = false;
            ShowImg = true;
            PutBlackBerryInExchange = true;


            if ((PackageId > 0) && (Cntx.Groups.ContainsKey(ResourceGroups.HostedOrganizations)))
            {
                MenuItemCollection items = new MenuItemCollection();

                OrganizationMenuRoot = new MenuItem(GetLocalizedString("Text.OrganizationGroup"), "", "", null);
                items.Add(OrganizationMenuRoot);

                if (ItemID > 0)
                {
                    OrganizationMenuRoot.ChildItems.Add(CreateMenuItem("OrganizationHome", "organization_home", @"Icons/organization_home_48.png"));
                    BindMenu(items);
                }
                else
                {
                    OrganizationMenuRoot.ChildItems.Add(CreateMenuItem("CreateOrganization", "create_organization", @"Icons/create_organization_48.png"));
                }


                UserOrgPanel.Visible = true;

                OrgList.DataSource = items;
                OrgList.DataBind();
            }
            else
                UserOrgPanel.Visible = false;

        }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:34,代码来源:UserOrganization.ascx.cs

示例8: PrepareRDSMenu

        private void PrepareRDSMenu(MenuItemCollection rdsItems)
        {
            rdsItems.Add(CreateMenuItem("RDSCollections", "rds_collections", null));

            if (Utils.CheckQouta(Quotas.RDS_SERVERS, Cntx) && (PanelSecurity.LoggedUser.Role != UserRole.User))
            {
                rdsItems.Add(CreateMenuItem("RDSServers", "rds_servers", null));
            }
        }
开发者ID:JohnyBuchar,项目名称:Websitepanel,代码行数:9,代码来源:OrganizationMenuControl.cs

示例9: PrepareExchangeMenuRoot

        private void PrepareExchangeMenuRoot(MenuItemCollection items)
        {
            bool hideItems = false;

            UserInfo user = UsersHelper.GetUser(PanelSecurity.EffectiveUserId);

            if (user != null)
            {
                if ((user.Role == UserRole.User) & (Utils.CheckQouta(Quotas.EXCHANGE2007_ISCONSUMER, Cntx)))
                    hideItems = true;
            }

            if (ShortMenu)
            {
                PrepareExchangeMenu(items, hideItems);
            }
            else
            {
                MenuItem item = new MenuItem(GetLocalizedString("Text.ExchangeGroup"), "", "", null);

                item.Selectable = false;

                PrepareExchangeMenu(item.ChildItems, hideItems);

                if (item.ChildItems.Count > 0)
                {
                    items.Add(item);
                }

                ExchangeMenuRoot = item;
            }
        }
开发者ID:JohnyBuchar,项目名称:Websitepanel,代码行数:32,代码来源:OrganizationMenuControl.cs

示例10: PrepareOrganizationMenu

        private void PrepareOrganizationMenu(MenuItemCollection items)
        {
            if (Utils.CheckQouta(Quotas.EXCHANGE2007_MAILBOXES, Cntx) == false)
            {
                if (Utils.CheckQouta(Quotas.ORGANIZATION_DOMAINS, Cntx))
                    items.Add(CreateMenuItem("DomainNames", "org_domains"));
            }
            
            if (Utils.CheckQouta(Quotas.ORGANIZATION_USERS, Cntx))
                items.Add(CreateMenuItem("Users", "users", @"Icons/user_48.png"));

            if (Utils.CheckQouta(Quotas.ORGANIZATION_DELETED_USERS, Cntx))
                items.Add(CreateMenuItem("DeletedUsers", "deleted_users", @"Icons/deleted_user_48.png"));

            if (Utils.CheckQouta(Quotas.ORGANIZATION_SECURITYGROUPS, Cntx))
                items.Add(CreateMenuItem("SecurityGroups", "secur_groups", @"Icons/group_48.png"));

            items.Add(CreateMenuItem("PasswordPolicy", "organization_settings_password_settings", @"Icons/user_48.png"));
        }
开发者ID:JohnyBuchar,项目名称:Websitepanel,代码行数:19,代码来源:OrganizationMenuControl.cs

示例11: BindMenu

        private void BindMenu(MenuItemCollection items, XmlNodeList nodes)
        {
            foreach (XmlNode node in nodes)
            {
                string pageId = null;
                if (node.Attributes["pageID"] != null)
                    pageId = node.Attributes["pageID"].Value;

                if (!PortalUtils.PageExists(pageId))
                    continue;

                string url = null;
                if (node.Attributes["url"] != null)
                    url = node.Attributes["url"].Value;

                string title = null;
                if (node.Attributes["title"] != null)
                    title = node.Attributes["title"].Value;

                string target = null;
                if (node.Attributes["target"] != null)
                    target = node.Attributes["target"].Value;

                string roles = null;
                if (node.Attributes["roles"] != null)
                    roles = node.Attributes["roles"].Value;

                string selectedUserContext = null;
                if (node.Attributes["selectedUserContext"] != null)
                    selectedUserContext = node.Attributes["selectedUserContext"].Value;
                
                // get custom page parameters
                XmlNodeList xmlParameters = node.SelectNodes("Parameters/Add");
                List<string> parameters = new List<string>();
                foreach (XmlNode xmlParameter in xmlParameters)
                {
                    parameters.Add(xmlParameter.Attributes["name"].Value
                        + "=" + xmlParameter.Attributes["value"].Value);
                }

                bool display = true;
				// set user role visibility second
                if (!String.IsNullOrEmpty(selectedUserContext))
                {
                    display = false;
                    string[] arrRoles = selectedUserContext.Split(',');
                    string userRole = PanelSecurity.SelectedUser.Role.ToString();
                    foreach (string role in arrRoles)
                    {
                        if (String.Compare(userRole, role, true) == 0)
                        {
                            display = true;
                            break;
                        }
                    }
                }

                if ((!String.IsNullOrEmpty(roles)) & display)
                {
                    display = false;
                    string[] arrRoles = roles.Split(',');
                    string userRole = PanelSecurity.LoggedUser.Role.ToString();
                    foreach (string role in arrRoles)
                    {
                        if (String.Compare(userRole, role, true) == 0)
                        {
                            display = true;
                            break;
                        }
                    }
                }
                
                //Audit Log functionality is disabled when user is in Demo mode
                if ((pageId == "AuditLog") && (PanelSecurity.SelectedUser.IsDemo))
                {
                      display = false;
                }
                
                // add menu item
                if (display)
                {
                    string pageUrl = !String.IsNullOrEmpty(url) ? url : PortalUtils.NavigatePageURL(
                        pageId, PortalUtils.USER_ID_PARAM, PanelSecurity.SelectedUserId.ToString(), parameters.ToArray());
                    string pageName = !String.IsNullOrEmpty(title) ? title : PortalUtils.GetLocalizedPageName(pageId);
                    MenuItem item = new MenuItem(pageName, "", "", pageUrl);

                    if (!String.IsNullOrEmpty(target))
                        item.Target = target;

                    items.Add(item);

                    // process nested menu items
                    XmlNodeList xmlNestedNodes = node.SelectNodes("MenuItems/MenuItem");
                    BindMenu(item.ChildItems, xmlNestedNodes);
                }
            }
        }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:97,代码来源:UserAccountMenu.ascx.cs

示例12: PrepareRDSMenu

        private void PrepareRDSMenu(MenuItemCollection rdsItems)
        {
            rdsItems.Add(CreateMenuItem("RDSCollections", "rds_collections", null));

            if (Utils.CheckQouta(Quotas.RDS_SERVERS, Cntx) && (PanelSecurity.LoggedUser.Role != UserRole.User))
            {
                rdsItems.Add(CreateMenuItem("RDSServers", "rds_servers", null));
            }

            if (Utils.CheckQouta(Quotas.ENTERPRICESTORAGE_DRIVEMAPS, Cntx))
            {
                rdsItems.Add(CreateMenuItem("EnterpriseStorageDriveMaps", "enterprisestorage_drive_maps", @"Icons/enterprisestorage_drive_maps_48.png"));
            }
        }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:14,代码来源:OrganizationMenuControl.cs

示例13: PrepareEnterpriseStorageMenu

 private void PrepareEnterpriseStorageMenu(MenuItemCollection enterpriseStorageItems)
 {
     enterpriseStorageItems.Add(CreateMenuItem("EnterpriseStorageFolders", "enterprisestorage_folders", @"Icons/enterprisestorage_folders_48.png"));            
 }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:4,代码来源:OrganizationMenuControl.cs

示例14: PrepareEnterpriseStorageMenu

        private void PrepareEnterpriseStorageMenu(MenuItemCollection enterpriseStorageItems)
        {
            enterpriseStorageItems.Add(CreateMenuItem("EnterpriseStorageFolders", "enterprisestorage_folders", @"Icons/enterprisestorage_folders_48.png"));

            if (Utils.CheckQouta(Quotas.ENTERPRICESTORAGE_DRIVEMAPS, Cntx))
            {
                enterpriseStorageItems.Add(CreateMenuItem("EnterpriseStorageDriveMaps", "enterprisestorage_drive_maps", @"Icons/enterprisestorage_drive_maps_48.png"));
            }
        }
开发者ID:JohnyBuchar,项目名称:Websitepanel,代码行数:9,代码来源:OrganizationMenuControl.cs

示例15: PrepareExchangeMenu

        private void PrepareExchangeMenu(MenuItemCollection exchangeItems, bool hideItems)
        {
            if (Utils.CheckQouta(Quotas.EXCHANGE2007_MAILBOXES, Cntx))
                exchangeItems.Add(CreateMenuItem("Mailboxes", "mailboxes", @"Icons/mailboxes_48.png"));

            if (Utils.CheckQouta(Quotas.EXCHANGE2007_CONTACTS, Cntx))
                exchangeItems.Add(CreateMenuItem("Contacts", "contacts", @"Icons/exchange_contacts_48.png"));

            if (Utils.CheckQouta(Quotas.EXCHANGE2007_DISTRIBUTIONLISTS, Cntx))
                exchangeItems.Add(CreateMenuItem("DistributionLists", "dlists", @"Icons/exchange_dlists_48.png"));

            //if (ShortMenu) return;

            if (Utils.CheckQouta(Quotas.EXCHANGE2007_PUBLICFOLDERS, Cntx))
                exchangeItems.Add(CreateMenuItem("PublicFolders", "public_folders", @"Icons/public_folders_48.png"));

            if (!hideItems)
                if (Utils.CheckQouta(Quotas.EXCHANGE2007_ACTIVESYNCALLOWED, Cntx))
                    exchangeItems.Add(CreateMenuItem("ActiveSyncPolicy", "activesync_policy", @"Icons/activesync_policy_48.png"));

            if (!hideItems)
                if (Utils.CheckQouta(Quotas.EXCHANGE2007_MAILBOXES, Cntx))
                    exchangeItems.Add(CreateMenuItem("MailboxPlans", "mailboxplans", @"Icons/mailboxplans_48.png"));

            if (!hideItems)
                if (Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWRETENTIONPOLICY, Cntx))
                    exchangeItems.Add(CreateMenuItem("RetentionPolicy", "retentionpolicy", @"Icons/retentionpolicy_48.png"));

            if (!hideItems)
                if (Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWRETENTIONPOLICY, Cntx))
                    exchangeItems.Add(CreateMenuItem("RetentionPolicyTag", "retentionpolicytag", @"Icons/retentionpolicytag_48.png"));

            if (!hideItems)
                if (Utils.CheckQouta(Quotas.EXCHANGE2007_MAILBOXES, Cntx))
                    exchangeItems.Add(CreateMenuItem("ExchangeDomainNames", "domains", @"Icons/domains_48.png"));

            if (!hideItems)
                if (Utils.CheckQouta(Quotas.EXCHANGE2007_MAILBOXES, Cntx))
                    exchangeItems.Add(CreateMenuItem("StorageUsage", "storage_usage", @"Icons/storage_usages_48.png"));

            if (!hideItems)
                if (Utils.CheckQouta(Quotas.EXCHANGE2007_DISCLAIMERSALLOWED, Cntx))
                    exchangeItems.Add(CreateMenuItem("Disclaimers", "disclaimers", @"Icons/disclaimers_48.png"));

        }
开发者ID:JohnyBuchar,项目名称:Websitepanel,代码行数:45,代码来源:OrganizationMenuControl.cs


注:本文中的System.Web.UI.WebControls.MenuItemCollection.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。