本文整理汇总了C#中System.Web.UI.WebControls.MenuItemCollection类的典型用法代码示例。如果您正苦于以下问题:C# MenuItemCollection类的具体用法?C# MenuItemCollection怎么用?C# MenuItemCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MenuItemCollection类属于System.Web.UI.WebControls命名空间,在下文中一共展示了MenuItemCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: DeluxeMenu
/// <summary>
/// PopupMenu构造函数
/// </summary>
/// <remarks></remarks>
public DeluxeMenu()
: base(true, HtmlTextWriterTag.Div)
{
this.items = new MenuItemCollection(null);
//this.Style.Add("Width", "0");
}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:11,代码来源:DeluxeMenu.cs
示例2: BuildItems
private void BuildItems(HtmlTextWriter writer, MenuItemCollection items, bool isRoot = false)
{
if (items.Count <= 0)
{
return;
}
string cssClass = "submenu";
if (isRoot)
{
cssClass = "nav sidebar-menu";
if (!string.IsNullOrEmpty(this.CssClass))
{
cssClass += " " + this.CssClass;
}
}
writer.AddAttribute(HtmlTextWriterAttribute.Class, cssClass);
writer.RenderBeginTag(HtmlTextWriterTag.Ul);
if (isRoot)
items = items[0].ChildItems;
foreach (MenuItem item in items)
{
this.BuildItem(writer, item);
}
writer.RenderEndTag(); // </ul>
}
开发者ID:viniciusrlopes,项目名称:LTM.Dashboard,代码行数:31,代码来源:SideBarMenu.cs
示例3: FindSelectedItem
MenuItem FindSelectedItem(MenuItemCollection items)
{
foreach (MenuItem item in items)
{
if (item.NavigateUrl.Length > 0 && Request.Path.Contains(item.NavigateUrl.Replace("~", "")))
{
return item;
}
MenuItem childSelected = FindSelectedItem(item.ChildItems);
if (childSelected != null)
return childSelected;
}
return null;
}
开发者ID:gbahns,项目名称:Tennis,代码行数:14,代码来源:Tennis.Master.cs
示例4: BindMenu
public void BindMenu(MenuItemCollection items)
{
if ((PackageId <= 0) || (ItemID <= 0))
return;
//Organization menu group;
if (Cntx.Groups.ContainsKey(ResourceGroups.HostedOrganizations))
PrepareOrganizationMenuRoot(items);
//Exchange menu group;
if (Cntx.Groups.ContainsKey(ResourceGroups.Exchange))
PrepareExchangeMenuRoot(items);
//BlackBerry Menu
if (Cntx.Groups.ContainsKey(ResourceGroups.BlackBerry))
PrepareBlackBerryMenuRoot(items);
//SharePoint menu group;
if (Cntx.Groups.ContainsKey(ResourceGroups.SharepointFoundationServer))
PrepareSharePointMenuRoot(items);
if (Cntx.Groups.ContainsKey(ResourceGroups.SharepointEnterpriseServer))
PrepareSharePointEnterpriseMenuRoot(items);
//CRM Menu
if (Cntx.Groups.ContainsKey(ResourceGroups.HostedCRM2013))
PrepareCRM2013MenuRoot(items);
else if (Cntx.Groups.ContainsKey(ResourceGroups.HostedCRM))
PrepareCRMMenuRoot(items);
//OCS Menu
if (Cntx.Groups.ContainsKey(ResourceGroups.OCS))
PrepareOCSMenuRoot(items);
//Lync Menu
if (Cntx.Groups.ContainsKey(ResourceGroups.Lync))
PrepareLyncMenuRoot(items);
//EnterpriseStorage Menu
if (Cntx.Groups.ContainsKey(ResourceGroups.EnterpriseStorage))
PrepareEnterpriseStorageMenuRoot(items);
//Remote Desktop Services Menu
if (Cntx.Groups.ContainsKey(ResourceGroups.RDS))
PrepareRDSMenuRoot(items);
}
开发者ID:JohnyBuchar,项目名称:Websitepanel,代码行数:46,代码来源:OrganizationMenuControl.cs
示例5: 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
示例6: QuitarItems
private void QuitarItems(MenuItemCollection items)
{
MenuItem[] itemsToRemove = new MenuItem[items.Count];
int i = 0;
if (UsuarioLogueado.TipoPersona == Persona.TiposPersonas.Alumno)
{
foreach (MenuItem item in items)
{
if((item.Value=="Alumno") || (item.Value=="Ambos"))
{
if (item.ChildItems.Count > 0) QuitarItems(item.ChildItems);
}
else
{
itemsToRemove[i] = item;
i++;
}
}
for (int j = 0; j < i; j++)
{
items.Remove(itemsToRemove[j]);
}
}
if (UsuarioLogueado.TipoPersona == Persona.TiposPersonas.Docente)
{
foreach (MenuItem item in items)
{
if ((item.Value == "Profesor") || (item.Value == "Ambos"))
{
if (item.ChildItems.Count > 0) QuitarItems(item.ChildItems);
}
else
{
itemsToRemove[i] = item;
i++;
}
}
for (int j = 0; j < i; j++)
{
items.Remove(itemsToRemove[j]);
}
}
}
开发者ID:serasio,项目名称:TP2,代码行数:44,代码来源:MenuPpal.aspx.cs
示例7: RemovePermissaoMenu
public void RemovePermissaoMenu(MenuItemCollection items)
{
ISeguranca iseguranca = Factory.GetInstance<ISeguranca>();
IList<int> indices = new List<int>();
for (int i = items.Count - 1; i >= 0; i--)
{
if (items[i].ChildItems.Count > 0)
{
RemovePermissaoMenu(items[i].ChildItems);
}
if (items[i].Value != "EMPTY" && !iseguranca.VerificarPermissao(((ViverMais.Model.Usuario)Session["Usuario"]).Codigo, items[i].Value.Split(':')[0].ToString(), int.Parse(items[i].Value.Split(':')[1].ToString())))
{
indices.Add(i);
}
}
foreach (int i in indices)
{
items.RemoveAt(i);
}
}
开发者ID:vivermais,项目名称:vivermais,代码行数:21,代码来源:MasterMain2.Master.cs
示例8: RenderDropDownMenu
protected void RenderDropDownMenu(HtmlTextWriter writer, MenuItemCollection items, string submenuClientId)
{
writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
writer.AddStyleAttribute(HtmlTextWriterStyle.Position, "absolute");
DynamicMenuStyle.AddAttributesToRender(writer);
writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
writer.AddAttribute(HtmlTextWriterAttribute.Id, submenuClientId);
writer.RenderBeginTag(HtmlTextWriterTag.Table);
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
for (int i = 0; i < items.Count; i++)
{
var childItem = items[i];
RenderDropDownMenuItem(writer, childItem, submenuClientId, i);
}
writer.RenderEndTag();
writer.RenderEndTag();
writer.RenderEndTag();
}
开发者ID:Jeff-Tian,项目名称:IZWebFileManager,代码行数:23,代码来源:BaseMenu.cs
示例9: BuildItems
private void BuildItems(MenuItemCollection items, bool isRoot, HtmlTextWriter writer)
{
if (items.Count > 0)
{
writer.WriteLine();
writer.WriteBeginTag("ul");
if (isRoot)
{
writer.WriteAttribute("class", "navig twolevel");
}
writer.Write(HtmlTextWriter.TagRightChar);
writer.Indent++;
foreach (MenuItem item in items)
{
BuildItem(item, writer);
}
writer.Indent--;
writer.WriteLine();
writer.WriteEndTag("ul");
}
}
开发者ID:tmthang-bi,项目名称:BrokerManager,代码行数:24,代码来源:MenuAdapter.cs
示例10: MenuItemCollectionEnumerator
internal MenuItemCollectionEnumerator(MenuItemCollection list) {
this.list = list;
this.index = -1;
version = list._version;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:5,代码来源:MenuItemCollection.cs
示例11: RenderMenuBody
void RenderMenuBody (HtmlTextWriter writer, MenuItemCollection items, bool vertical, bool dynamic)
{
if (!vertical) writer.RenderBeginTag (HtmlTextWriterTag.Tr);
for (int n=0; n<items.Count; n++) {
MenuItem item = items [n];
if (n > 0) {
Unit itemSpacing = GetItemSpacing (item, dynamic);
if (itemSpacing != Unit.Empty) {
if (vertical) {
writer.AddAttribute ("height", itemSpacing.ToString());
writer.RenderBeginTag (HtmlTextWriterTag.Tr);
writer.RenderEndTag ();
} else {
writer.AddAttribute ("width", itemSpacing.ToString());
writer.RenderBeginTag (HtmlTextWriterTag.Td);
writer.RenderEndTag ();
}
}
}
RenderMenuItem (writer, item);
}
if (!vertical) writer.RenderEndTag (); // TR
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:25,代码来源:Menu.cs
示例12: RenderMenu
void RenderMenu (HtmlTextWriter writer, MenuItemCollection items, bool vertical, bool dynamic, int menuLevel)
{
RenderMenuBeginTag (writer, dynamic, menuLevel);
RenderMenuBody (writer, items, vertical, dynamic);
RenderMenuEndTag (writer);
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:6,代码来源:Menu.cs
示例13: LoadNavigation
/// <summary>
/// Loops through the list items in the MyNiem List and gets the navigation based on access.
/// </summary>
/// <param name="List"></param>
protected void LoadNavigation(SPList List)
{
try
{
if (Page.User.Identity.IsAuthenticated)
{
SPListItemCollection Items = List.Items;
var PersonalNav = LoginView1.FindControl("PersonalNav") as AspMenu;
MenuItemCollection MenuItems = new MenuItemCollection();
//grabs the items in the list then loops through the webs the user currently has access too
foreach (SPListItem Item in Items)
{
//old code to recursively check if the user has access to the subweb
//if (Web.Url.ToLower() == SPContext.Current.Web.Site.RootWeb.Url.ToLower() + "/" + Item["Title"].ToString().ToLower())
// FoundWeb = true;
//else
// FoundWeb = GetSubWebs(Web, SPContext.Current.Web.Site.RootWeb.Url.ToLower() + "/" + Item["Title"].ToString().ToLower(), FoundWeb);
//Guid SiteGuid = SPContext.Current.Site.ID;
string SiteURL = SPContext.Current.Web.Site.RootWeb.Url.ToLower();
SPUser CurrentUser = SPContext.Current.Web.CurrentUser;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
#region OldCode
// if (FoundWeb)
// {
// using (SPSite Site = new SPSite(SPContext.Current.Web.Site.RootWeb.Url.ToLower() + "/" + Item["Title"].ToString()))
// {
// using (SPWeb FoundSubWeb = Site.OpenWeb())
// {
// MenuItem MyNiemItem = new MenuItem(FoundSubWeb.Title, FoundSubWeb.Title, "", FoundSubWeb.Url);
// int CompareNumber = 0;
// for(int i=0;i<MenuItems.Count && CompareNumber>=0;i++)
// {
// string CompareItem = MyNiemItem.Text;
// CompareNumber = CompareItem.CompareTo(MenuItems[i].Text);
// if(CompareNumber < 0)
// MenuItems.AddAt(i, MyNiemItem);
// }
// if(CompareNumber>=0)
// MenuItems.Add(MyNiemItem);
// FoundWeb = false;
// }
// }
// }
//}
//foreach (MenuItem Item in MenuItems)
//{
// PersonalNav.Items.Add(Item);
//}
#endregion
//new code to check against site
using (SPSite Site = new SPSite(SiteURL + "/" + Item["Title"].ToString()))
{
using (SPWeb Web = Site.OpenWeb())
{
if (Web.DoesUserHavePermissions(CurrentUser.LoginName, SPBasePermissions.Open))
{
MenuItem MyNiemItem = new MenuItem(Web.Title, Web.Title, "", Web.Url);
int CompareNumber = 0;
for (int i = 0; i < MenuItems.Count && CompareNumber >= 0; i++)
{
string CompareItem = MyNiemItem.Text;
CompareNumber = CompareItem.CompareTo(MenuItems[i].Text);
if (CompareNumber < 0)
MenuItems.AddAt(i, MyNiemItem);
}
if (CompareNumber >= 0)
MenuItems.Add(MyNiemItem);
}
}
}
});
}
foreach (MenuItem Item in MenuItems)
{
PersonalNav.Items.Add(Item);
}
}
}
catch (SPException ex)
{
UpdateErrorLog(ex);
}
}
开发者ID:NIEM-Web,项目名称:Sharepoint,代码行数:91,代码来源:PersonalMenu.ascx.cs
示例14: BuildItems
private void BuildItems(MenuItemCollection items, bool isRoot, HtmlTextWriter writer)
{
if (items.Count > 0)
{
writer.WriteLine();
writer.WriteBeginTag("ul");
if (isRoot)
{
if (!string.IsNullOrEmpty(Control.CssClass))
{
writer.WriteAttribute("class", Control.CssClass);
}
if (Control.ID != "SubNavMenu")
{
writer.WriteAttribute("id", Control.ID);
}
}
else if (_nextingLevel < Control.StaticDisplayLevels)
{
writer.WriteAttribute("style", "position: relative !important; visibility: visible !important;");
}
else if (items[0].Parent.Text == "Contact Us")
{
writer.WriteAttribute("style", "width: 128px !important;");
}
writer.Write(HtmlTextWriter.TagRightChar);
writer.Indent++;
foreach (MenuItem item in items)
{
BuildItem(item, writer);
}
writer.Indent--;
writer.WriteLine();
writer.WriteEndTag("ul");
}
}
开发者ID:brandongrossutti,项目名称:DotCopter,代码行数:39,代码来源:MenuAdapter.cs
示例15: 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
示例16: CreateChildControlsForItems
void CreateChildControlsForItems (MenuItemCollection items ) {
foreach (MenuItem item in items) {
bool isDynamicItem = IsDynamicItem (item);
if (isDynamicItem && dynamicItemTemplate != null) {
MenuItemTemplateContainer cter = new MenuItemTemplateContainer (item.Index, item);
dynamicItemTemplate.InstantiateIn (cter);
_menuItemControls [item] = cter;
Controls.Add (cter);
}
else if (!isDynamicItem && staticItemTemplate != null) {
MenuItemTemplateContainer cter = new MenuItemTemplateContainer (item.Index, item);
staticItemTemplate.InstantiateIn (cter);
_menuItemControls [item] = cter;
Controls.Add (cter);
}
if (item.HasChildData)
CreateChildControlsForItems (item.ChildItems);
}
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:19,代码来源:Menu.cs
示例17: setMenuItemChild
private void setMenuItemChild(MenuItemCollection mic, params MenuInfo[] menuItems)
{
try
{
mic.Clear();
foreach (MenuInfo menuItem in menuItems)
{
if (menuItem.Text != "-")
{
MenuItem mi = new MenuItem(menuItem.Text, menuItem.Text);
mi.Enabled = menuItem.Enabled;
if (
String.IsNullOrEmpty(menuItem.NavigateUrl)
&& menuItem.Text != "Storage connection"
&& menuItem.Text != "Refresh"
&& menuItem.SubMenus.Count == 0
)
{
mi.NavigateUrl = String.Format("javascript:openDialog('ModalDialogHandler.aspx?MenuItem={0}&MenuValue={1}');", mi.Text, mi.Value);
}
else if (!String.IsNullOrEmpty(menuItem.NavigateUrl))
{
mi.NavigateUrl = menuItem.NavigateUrl;
if (!mi.NavigateUrl.StartsWith("javascript:", StringComparison.CurrentCultureIgnoreCase))
mi.Target = "_blank";
}
mi.ToolTip = menuItem.ToolTip;
switch (menuItem.Text)
{
case "Storage connection": mi.ImageUrl = this.getImageUrl("db.gif"); break;
case "Options": mi.ImageUrl = this.getImageUrl("Options_16x16.gif"); break;
case "Invalidate WCF Cache Service": mi.ImageUrl = this.getImageUrl("Cache_16x16.gif"); break;
case "New Store":
case "New Application":
case "New Store Group":
case "New Application Group":
case "New Role":
case "New Task":
case "New Operation":
mi.ImageUrl = this.getImageUrl("new.gif"); break;
case "Import Store from AzMan":
mi.ImageUrl = this.getImageUrl("azman.gif"); break;
case "Import Stores":
case "Import Store Groups/Application":
case "Import Application Groups/Items":
case "Import Store Groups":
case "Import Application Groups":
case "Import Items":
mi.ImageUrl = this.getImageUrl("import.gif"); break;
case "Export Stores":
case "Export Store":
case "Export Application":
case "Export Store Group":
case "Export Application Group":
case "Export Items":
mi.ImageUrl = this.getImageUrl("export.gif"); break;
case "Refresh": mi.ImageUrl = this.getImageUrl("refresh.gif"); break;
case "Store Properties": mi.ImageUrl = this.getImageUrl("Store_16x16.gif"); break;
case "Items Hierarchical View":
case "Items Hierarchy":
mi.ImageUrl = this.getImageUrl("Hierarchy_16x16.gif"); break;
case "Reports": mi.ImageUrl = this.getImageUrl("print.gif"); break;
case "Delete": mi.ImageUrl = this.getImageUrl("delete.gif"); break;
case "Items Authorizations": mi.ImageUrl = this.getImageUrl("ItemAuthorization_16x16.gif"); break;
case "Mode and Logging": mi.ImageUrl = this.getImageUrl("NetSqlAzMan_16x16.gif"); break;
case "Auditing": mi.ImageUrl = this.getImageUrl("SqlAudit_16x16.gif"); break;
case "Application Properties": mi.ImageUrl = this.getImageUrl("Application_16x16.gif"); break;
case "Generate CheckAccessHelper": mi.ImageUrl = this.getImageUrl("vsnet_16x16.gif"); break;
case "Check Access Test": mi.ImageUrl = this.getImageUrl("CheckAccessTest_16x16.gif"); break;
case "Application Group Properties":
case "Store Group Properties": mi.ImageUrl = this.getImageUrl("StoreApplicationGroup_16x16.gif"); break;
case "Role Properties": mi.ImageUrl = this.getImageUrl("Role_16x16.gif"); break;
case "Task Properties": mi.ImageUrl = this.getImageUrl("Task_16x16.gif"); break;
case "Operation Properties": mi.ImageUrl = this.getImageUrl("Operation_16x16.gif"); break;
case "Effective Permissions": mi.ImageUrl = this.getImageUrl("EffectivePermissions_16x16.gif"); break;
case "Manage Authorizations": mi.ImageUrl = this.getImageUrl("ItemAuthorization_16x16.gif"); break;
default: mi.ImageUrl = this.getImageUrl("blank.gif"); break;
}
mic.Add(mi);
this.setMenuItemChild(mi.ChildItems, menuItem.SubMenus.ToArray());
}
else
{
mic[mic.Count - 1].SeparatorImageUrl = "Images/Separator.jpg";
}
}
}
catch (Exception ex)
{
this.ShowError(ex.Message);
}
}
开发者ID:JamesTryand,项目名称:NetSqlAzMan,代码行数:92,代码来源:WebConsole.aspx.cs
示例18: BuildItems
private void BuildItems(MenuItemCollection items, bool isRoot, HtmlTextWriter writer)
{
if (items.Count > 0)
{
writer.WriteLine();
writer.WriteBeginTag("ul");
if (isRoot)
{
// Outer list menu
writer.WriteAttribute("class", "nav");
}
else
{
// Sub Menue
writer.WriteAttribute("class", "dropdown-menu");
}
writer.Write(HtmlTextWriter.TagRightChar);
writer.Indent++;
foreach (MenuItem item in items)
{
BuildItem(item, writer);
}
writer.Indent--;
writer.WriteLine();
writer.WriteEndTag("ul");
}
}
开发者ID:JenasysDesign,项目名称:BootstrapControlAdapters,代码行数:31,代码来源:MenuAdapter.cs
示例19: RenderMenuBody
public override void RenderMenuBody (HtmlTextWriter writer, MenuItemCollection items, bool vertical, bool dynamic, bool notLast)
{
Menu owner = Owner;
if (!vertical)
writer.RenderBeginTag (HtmlTextWriterTag.Tr);
int count = items.Count;
var oc = new OwnerContext (this);
for (int n = 0; n < count; n++) {
MenuItem item = items [n];
Adapters.MenuAdapter adapter = owner.Adapter as Adapters.MenuAdapter;
if (adapter != null)
adapter.RenderItem (writer, item, n);
else
RenderMenuItem (writer, item, vertical, (n + 1) == count ? notLast : true, n == 0, oc);
}
if (!vertical)
writer.RenderEndTag (); // TR
}
开发者ID:Profit0004,项目名称:mono,代码行数:21,代码来源:MenuTableRenderer.cs
示例20: LogItem
public LogItem(MenuItemCollection.LogItemType type, int index, bool tracked)
{
this._type = type;
this._index = index;
this._tracked = tracked;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:6,代码来源:MenuItemCollection.cs
注:本文中的System.Web.UI.WebControls.MenuItemCollection类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论