• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# WebControls.MenuItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



MenuItem类属于System.Web.UI.WebControls命名空间,在下文中一共展示了MenuItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            ShopEntities dbShop = new ShopEntities();

            NavigationMenu.Items[1].ChildItems.Clear();
            foreach (var category in dbShop.Categories)
            {
                var menuItem = new MenuItem(category.Name, category.id.ToString(), "", category.NavigateUrl);
                NavigationMenu.Items[1].ChildItems.Add(menuItem);
            }
        }
开发者ID:Elta20042004,项目名称:YoYo,代码行数:11,代码来源:Site.Master.cs


示例2: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            TreeView treeForum;
            Conector con = new Conector();
            /////////////////////////////////////Forum ID->Server ID////////////////////////////////////
            MembershipUser m = Membership.GetUser();
            if (m!=null)
            {
                SqlDataReader is_allrady_Reg = con.select("SELECT   TOP (1)  Server_id_user FROM         IDs_Server_and_Forum WHERE     (Forum_id_user = '" + m.ProviderUserKey.ToString() + "')");
                if (!is_allrady_Reg.Read())
                {
                    int id_server;
                    SqlDataReader id_server_new = con.select("SELECT   TOP (1)  Forum_id_user FROM         IDs_Server_and_Forum ORDER BY Forum_id_user DESC");
                    if (id_server_new.Read())
                    {
                        id_server = Convert.ToInt32(id_server_new[0].ToString());
                    }
                    else
                        id_server = 0;
                    con.insert("INSERT INTO IDs_Server_and_Forum  (Server_id_user, Forum_id_user) VALUES     (" + id_server + ",'" + m.ProviderUserKey.ToString() + "')");
                    con.insert("INSERT INTO Server_info  (ID_Client) VALUES     (" + id_server + ")");
                }
            }

            ////////////////////////////////////////////////////////////////////////////////////////////
            SqlDataReader Forum;
            SqlDataReader SabForum;

            int i = 0;
            Forum = con.select("SELECT id, name FROM forum");
            treeForum = this.TreeView1;
            ContentPlaceHolder menu = (ContentPlaceHolder)Master.FindControl("menu");
            Menu men = (Menu)menu.FindControl("NavigationMenu");
            if (Roles.IsUserInRole("Users") || Roles.IsUserInRole("Admins"))
            {
                MenuItem it = new MenuItem("Создать раздачю");
                it.NavigateUrl= "~/Forum/Create_topic.aspx";
                men.Items.Add(it);
            }

            while (Forum.Read())
            {

                TreeNode t =new TreeNode(Forum[1].ToString());
                t.NavigateUrl="~/Forum/ShowForum.aspx?forum="+Forum[0].ToString();
                treeForum.Nodes.Add(t);
                SabForum = con.select("SELECT     name, id FROM         subforum WHERE     (forum = "+Forum[0].ToString()+")");
                 while(SabForum.Read())
                 {

                    TreeNode t1 = new TreeNode(SabForum[0].ToString());
                     t1.NavigateUrl="~/Forum/ShowSabForum.aspx?forum="+Forum[0].ToString()+"&subforum="+SabForum[1].ToString();
                    treeForum.Nodes[i].ChildNodes.Add(t1);

                }
                 i++;
            }

            con.con_close();
        }
开发者ID:yaroslavchuvaev,项目名称:p2p,代码行数:60,代码来源:Default.aspx.cs


示例3: AddChildMenuItems

        private void AddChildMenuItems(DataTable menuData, MenuItem parentMenuItem)
        {
            DataView view = null;
            try
            {
                view = new DataView(menuData);
                view.RowFilter = "ParentID=" + parentMenuItem.Value;
                foreach (DataRowView row in view)
                {
                    MenuItem newMenuItem = new MenuItem(row["Text"].ToString(), row["MenuID"].ToString());
                    newMenuItem.NavigateUrl = row["NavigateUrl"].ToString();
                    parentMenuItem.ChildItems.Add(newMenuItem);

                    AddChildMenuItems(menuData, newMenuItem);
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
            finally
            {
                view = null;
            }
        }
开发者ID:jtomaylla,项目名称:gitSEISPY,代码行数:25,代码来源:Site.Master.cs


示例4: IsLink

        private bool IsLink(MenuItem item)
        {
            if (item == null)
                throw new ArgumentNullException("item");

            return item.Enabled && !string.IsNullOrEmpty(item.NavigateUrl);
        }
开发者ID:fabriciogs,项目名称:Bootstrap.WebForms.Controls,代码行数:7,代码来源:Menu.cs


示例5: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     if(!IsPostBack)
     {
         var categories = (from category in ent.Kategoriler
                           where category.silindi == false
                           select category).ToList();
         foreach (var kategori in categories)
         {
             MenuItem mitm = new MenuItem();
             mitm.Text = kategori.kategoriad;
             mitm.Value = kategori.ID.ToString();
             mnuKategoriler.Items.Add(mitm);
             var subcategories = (from subcategory in ent.AltKategoriler
                               where subcategory.silindi == false && subcategory.kategorino == kategori.ID
                               select subcategory).ToList();
             foreach (var altkategori in subcategories)
             {
                 MenuItem citm = new MenuItem();
                 citm.Text = altkategori.altkategoriad;
                 citm.Value = altkategori.ID.ToString();
                 mitm.ChildItems.Add(citm);
             }
         }
     }
 }
开发者ID:ykeremuzun,项目名称:SaglikUrunleri,代码行数:26,代码来源:Site1.Master.cs


示例6: GenerateHtml

        public string GenerateHtml(string currentUrl, string currentPage,Func<string,string> virtualPathResolver)
        {
            var items = BuildMenu(currentUrl, currentPage);
             StringBuilder menuText = new StringBuilder();
            menuText.Append("<ul>");
            foreach (var item in items)
            {
                var menuitem = new MenuItem()
                                   {
                                       Text = item.Text,
                                       NavigateUrl = item.Url,
                                       Selected = item.Selected
                                   };

                menuText.Append("<li>");
                menuText.AppendFormat("<a href=\"{0}\" ", virtualPathResolver(menuitem.NavigateUrl));
                if (menuitem.Selected)
                {
                    menuText.Append("class=\"selected\"");
                }
                menuText.AppendFormat(">{0}</a></li>", menuitem.Text);
            }
            menuText.Append("</ul>");
            //menuText.Append("<div style=\"float:clear;\"></div>");
               return menuText.ToString();
        }
开发者ID:chrisortman,项目名称:CvDnug,代码行数:26,代码来源:03_MainMenu.cs


示例7: Page_Load

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

            // organization
            bool orgVisible = (PanelRequest.ItemID > 0 && Request[DefaultPage.PAGE_ID_PARAM].Equals(PID_SPACE_EXCHANGE_SERVER, StringComparison.InvariantCultureIgnoreCase));

            orgMenu.Visible = orgVisible;

            if (orgVisible)
            {
                MenuItem rootItem = new MenuItem(locMenuTitle.Text);
                rootItem.Selectable = false;

                menu.Items.Add(rootItem);

                //Add "Organization Home" menu item
                MenuItem item = new MenuItem(
                    GetLocalizedString("Text.OrganizationHome"),
                    "",
                    "",
                    PortalUtils.EditUrl("ItemID", PanelRequest.ItemID.ToString(), "organization_home", "SpaceID=" + PanelSecurity.PackageId));

                rootItem.ChildItems.Add(item);

                BindMenu(rootItem.ChildItems);
            }
        }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:29,代码来源:OrganizationMenu.ascx.cs


示例8: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         var Categories = from category in ent.Kategoriler
                          where category.silindi == false
                          select new { category.id, category.kategoriad };
         foreach (var kategori in Categories)
         {
             MenuItem mitm = new MenuItem();
             mitm.Text = kategori.kategoriad;
             mitm.Value = kategori.id.ToString();
             mnuKategoriler.Items.Add(mitm);
             var SubCategories = from subcategory in ent.AltKategoriler
                              where subcategory.silindi == false && subcategory.kategorino == kategori.id
                              select new { subcategory.id, subcategory.altkategoriad };
             foreach (var altkategori in SubCategories)
             {
                 MenuItem citm = new MenuItem();
                 citm.Text = altkategori.altkategoriad;
                 citm.Value = altkategori.id.ToString();
                 mitm.ChildItems.Add(citm);
             }
         }
     }
 }
开发者ID:AlptugYaman,项目名称:SaglikUrunleri,代码行数:26,代码来源:Site1.Master.cs


示例9: llenarMenu

        private void llenarMenu(List<Entidades.MenuXrol> menus, int requiereSesion)
        {
            Entidades.Usuarios us = (Entidades.Usuarios)context.Session["usuario"];
            if (us != null)
            {
                List<Entidades.MenuXrol> menusPadre;
                var consultaPadres = from m in menus
                                     where m.IdMenu.Nodo == 0
                                     where m.IdMenu.Sesion == requiereSesion
                                     orderby m.IdMenu.Orden
                                     select m;
                menusPadre = consultaPadres.ToList();

                menusPadre.ForEach(delegate (Entidades.MenuXrol menu)
                {
                    MenuItem miMenuItem = new MenuItem(menu.IdMenu.Nombre, string.Empty, string.Empty, menu.IdMenu.Url);
                    List<Entidades.MenuXrol> submenus;
                    var consultaSubmenus = from m in menus
                                           where m.IdMenu.Nodo == menu.IdMenu.IdMenu
                                           where m.IdMenu.Sesion == requiereSesion
                                           orderby m.IdMenu.Orden
                                           select m;
                    submenus = consultaSubmenus.ToList();
                    submenus.ForEach(delegate (Entidades.MenuXrol submenu)
                    {
                        MenuItem miMenuItemChild = new MenuItem(submenu.IdMenu.Nombre, string.Empty, string.Empty, submenu.IdMenu.Url);
                        //this.MyMenu.Items.Add(miMenuItemChild);
                        miMenuItem.ChildItems.Add(miMenuItemChild);
                    });
                    this.Menu1.Items.Add(miMenuItem);
                });

            }
        }
开发者ID:prodevelop001,项目名称:ControlServidores,代码行数:34,代码来源:Sitio.Master.cs


示例10: setMenuData

        protected void setMenuData()
        {
            Menu menu = new Menu();
            MenuItem item;

            item = new MenuItem();
            item.Text = "Home Page";
            item.Value = "valueHomePage";
            menu.Items.Add(item);
            item = null;

            item = new MenuItem();
            item.Text = "Contact Us";
            item.Value = "valueContactUs";
            menu.Items.Add(item);
            item = null;

            item = new MenuItem();
            item.Text = "Productions";
            item.Value = "valueProductions";
            menu.Items.Add(item);
            item = null;

            item = new MenuItem();
            item.Text = "Compare";
            item.Value = "valueCompare";
            menu.Items.Add(item);
            item = null;

            item = new MenuItem();
            item.Text = "Links";
            item.Value = "valueLinks";
            menu.Items.Add(item);
            item = null;
        }
开发者ID:salahmyn,项目名称:galileovietnam,代码行数:35,代码来源:LeftMenuControl.ascx.cs


示例11: setMenuItem

        protected void setMenuItem()
        {
            Menu menu = (Menu)this.FindControl("mnuLeft");
            MenuItem item;

            item = new MenuItem();
            item.Text = "MacBook";
            item.Value = "valueMacBook";
            menu.Items.Add(item);
            item = null;

            item = new MenuItem();
            item.Text = "MacBook Pro";
            item.Value = "valueMacBookPro";
            menu.Items.Add(item);
            item = null;

            item = new MenuItem();
            item.Text = "MacBook Air";
            item.Value = "valueMacBookAir";
            menu.Items.Add(item);
            item = null;

            item = new MenuItem();
            item.Text = "Mac mini";
            item.Value = "valueMacMini";
            menu.Items.Add(item);
            item = null;
        }
开发者ID:salahmyn,项目名称:galileovietnam,代码行数:29,代码来源:LeftMenuControl.ascx.cs


示例12: LeftMenuHazirla

        /// <summary>
        /// <remarks>Ana ve alt kategorileri Linq ile alıp Menu ve MenuItem kullanır</remarks>
        /// </summary>
        public void LeftMenuHazirla()
        {
            try
            {
                Models.PoliklinikEntities5 p = new Models.PoliklinikEntities5();
                var res = from c in p.UrunKategori
                          select new { Adi = c.Adi, ID = c.AnaKategoriID };

                foreach (var item in res.ToList())
                {
                    MenuItem Ana = new MenuItem();
                    Ana.Text = item.Adi;
                    Ana.NavigateUrl = @"MainPage.aspx?KatID=" + item.ID.ToString();
                    var res1 = from c in p.UrunKategori
                               join d in p.UrunAltKategori on c.AnaKategoriID equals d.AnaKategori
                               where c.AnaKategoriID == item.ID
                               select new { ID = c.AnaKategoriID, AltKatID = d.AltKategoriID, AltKatAdi = d.Adi };
                    foreach (var altkat in res1.ToList())
                    {
                        MenuItem Alt = new MenuItem();
                        Alt.Text = altkat.AltKatAdi;
                        Alt.NavigateUrl = @"UrunListesi.aspx?KatID=" + item.ID.ToString() + "&AltKatID=" + altkat.AltKatID.ToString();
                        Ana.ChildItems.Add(Alt);
                    }

                    Menu1.Items.Add(Ana);
                }
            }
            catch (Exception)
            {

                throw;
            }
        }
开发者ID:tamerin1,项目名称:e-commerce,代码行数:37,代码来源:default.aspx.cs


示例13: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session.Contents["userid"] != null)
            {
                if (Session.Contents["rol"].ToString().Equals("DSTADM"))
                {
                    MenuItem childItem = new MenuItem();
                    MenuItem childItem2 = new MenuItem();
                    MenuItem childItem3 = new MenuItem();

                    childItem2.Text = "Clientes Existentes";
                    childItem2.NavigateUrl = "../Dst/Solicitud_Dispensadores.aspx";

                    childItem3.Text = "Clientes Nuevos";
                    childItem3.NavigateUrl = "../Dst/Solicitud_Clientes_Nuevos.aspx";

                    childItem.ChildItems.Add(childItem3);
                    childItem.ChildItems.Add(childItem2);
                    childItem.Text = "Solicitud Dispensadores";
                    childItem.Selectable = false;
                    NavigationMenu.Items[1].ChildItems.AddAt(0, childItem);
                    NavigationMenu.Items[1].ChildItems[1].NavigateUrl = "../Dst/SeguimientoSolicitudes.aspx";

                    NavigationMenu.Items[2].ChildItems[0].ChildItems.RemoveAt(1);
                    NavigationMenu.Items[2].ChildItems[0].ChildItems.RemoveAt(0);
                    NavigationMenu.Items[2].ChildItems[1].Text = "Vendedores";
                    NavigationMenu.Items[2].ChildItems.RemoveAt(2);
                    NavigationMenu.Items.RemoveAt(3);
                }
            }
        }
开发者ID:Eliazar,项目名称:Dispenser_Tracking,代码行数:31,代码来源:Mantenimiento.Master.cs


示例14: IsNavHeader

        private bool IsNavHeader(MenuItem item)
        {
            if (item == null)
                throw new ArgumentNullException("item");

            return item.ToolTip.Equals("*IsNavHeader*");
        }
开发者ID:fabriciogs,项目名称:Bootstrap.WebForms.Controls,代码行数:7,代码来源:Menu.cs


示例15: HasChildren

        private bool HasChildren(MenuItem item)
        {
            if (item == null)
                throw new ArgumentNullException("item");

            return item.ChildItems.Count > 0;
        }
开发者ID:fabriciogs,项目名称:Bootstrap.WebForms.Controls,代码行数:7,代码来源:Menu.cs


示例16: AddChildMenuItems

 private void AddChildMenuItems(DataTable menuData, MenuItem parentMenuItem)
 {
     DataView view = null;
     try
     {
         view = new DataView(menuData);
         view.RowFilter = "ParentID=" + parentMenuItem.Value;
         foreach (DataRowView row in view)
         {
             MenuItem newMenuItem = new MenuItem(row["Text"].ToString(), row["MenuID"].ToString());
             newMenuItem.NavigateUrl = row["NavigateUrl"].ToString();
             parentMenuItem.ChildItems.Add(newMenuItem);
             // This code is used to recursively add child menu items filtering by ParentID
             AddChildMenuItems(menuData, newMenuItem);
         }
     }
     catch (Exception ex)
     {
         //Show the error massage here
     }
     finally
     {
         view = null;
     }
 }
开发者ID:fernandocarrasco,项目名称:BitOP,代码行数:25,代码来源:Inicio.aspx.cs


示例17: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var kategoriler = (from kategori in ent.Kategoriler
                                   where kategori.silindi==false
                                   select kategori).ToList();
                foreach (var ktg in kategoriler)
                {
                    MenuItem mitm = new MenuItem();
                    mitm.Text = ktg.kategoriad;
                    mitm.Value = ktg.id.ToString();
                    menuKategoriler.Items.Add(mitm);

                    var altkategoriler = (from altkategori in ent.AltKategoriler
                                          where altkategori.silindi==false && altkategori.kategorino == ktg.id
                                          select altkategori).ToList();

                    foreach (var altktg in altkategoriler)
                    {
                        MenuItem mitmalt = new MenuItem();
                        mitmalt.Text = altktg.altkategoriad.ToString();
                        mitmalt.Value = altktg.id.ToString();
                        mitm.ChildItems.Add(mitmalt);
                    }
                }

            }
        }
开发者ID:arslanaybars,项目名称:CSharp-Workspace,代码行数:29,代码来源:Site1.Master.cs


示例18: AddAt

        public void AddAt(int index, MenuItem child) {
            if (child == null) {
                throw new ArgumentNullException("child");
            }

            if (child.Owner != null && child.Parent == null) {
                child.Owner.Items.Remove(child);
            }
            if (child.Parent != null) {
                child.Parent.ChildItems.Remove(child);
            }

            if (_owner != null) {
                child.SetParent(_owner);
                child.SetOwner(_owner.Owner);
            }

            _list.Insert(index, child);
            _version++;

            if (_isTrackingViewState) {
                ((IStateManager)child).TrackViewState();
                child.SetDirty();
            }
            Log.Add(new LogItem(LogItemType.Insert, index, _isTrackingViewState));
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:26,代码来源:MenuItemCollection.cs


示例19: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
           // NavigationMenu.Visible = Page.User.Identity.IsAuthenticated;
            NavigationMenu.Visible = false;

    /*
            <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Главная"/>
            <asp:MenuItem NavigateUrl="~/List.aspx" Text="Список заявок"/>
            <asp:MenuItem NavigateUrl="~/Request.aspx" Text="Добавить заявку"/>
            <asp:MenuItem NavigateUrl="~/NewElevator.aspx" Text="Добавить лифт"  />
            <asp:MenuItem NavigateUrl="~/NewArea.aspx" Text="Создать участок"/>
            <asp:MenuItem NavigateUrl="~/AddAddressToArea.aspx" Text="Добавить новый адрес к участку"/>
            <asp:MenuItem NavigateUrl="~/NewRequestor.aspx" Text="Добавить заказчика"/>
            <asp:MenuItem NavigateUrl="~/About.aspx" Text="Обратная связь"/>
        */
            if (Page.User.IsInRole("Admin")) 
            {
                NavigationMenu.Visible = true;
                /*
                    <asp:MenuItem NavigateUrl="~/List.aspx" Text="Список заявок"/>
                    <asp:MenuItem NavigateUrl="~/Request.aspx" Text="Добавить заявку"/>
                    <asp:MenuItem NavigateUrl="~/NewElevator.aspx" Text="Добавить лифт"  />
                    <asp:MenuItem NavigateUrl="~/NewArea.aspx" Text="Создать участок"/>
                    <asp:MenuItem NavigateUrl="~/AddAddressToArea.aspx" Text="Добавить новый адрес к участку"/>
                    <asp:MenuItem NavigateUrl="~/NewRequestor.aspx" Text="Добавить заказчика"/>
                    <asp:MenuItem NavigateUrl="~/About.aspx" Text="Обратная связь"/>
                 */
                MenuItem tmp = new MenuItem("Список заявок", "", "", "~/List.aspx");
                NavigationMenu.Items.Add(tmp);
                tmp = new MenuItem("Добавить заявку", "", "", "~/Request.aspx");
                NavigationMenu.Items.Add(tmp);
                tmp = new MenuItem("Добавить лифт", "", "", "~/NewElevator.aspx");
                NavigationMenu.Items.Add(tmp);
                tmp = new MenuItem("Создать участок", "", "", "~/NewArea.aspx");
                NavigationMenu.Items.Add(tmp);
                tmp = new MenuItem("Добавить новый адрес к участку", "", "", "~/AddAddressToArea.aspx");
                NavigationMenu.Items.Add(tmp);
                tmp = new MenuItem("Добавить заказчика", "", "", "~/NewRequestor.aspx");
                NavigationMenu.Items.Add(tmp);
                tmp = new MenuItem("Обратная связь", "", "", "~/About.aspx");
                NavigationMenu.Items.Add(tmp); 
            }
            else if (Page.User.IsInRole("User"))
            {
                NavigationMenu.Visible = true;

                MenuItem tmp = new MenuItem("Список заявок", "", "", "~/List.aspx");
                NavigationMenu.Items.Add(tmp);
                tmp = new MenuItem("Обратная связь", "", "", "~/About.aspx");
                NavigationMenu.Items.Add(tmp); 
            }
            else 
            {
                NavigationMenu.Visible = Page.User.Identity.IsAuthenticated;
            }


        }
开发者ID:npenkrat,项目名称:las,代码行数:58,代码来源:Site.Master.cs


示例20: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            MenuItem rootItem = new MenuItem(locMenuTitle.Text);
            rootItem.Selectable = false;

            menu.Items.Add(rootItem);

            BindMenu(rootItem.ChildItems, PortalUtils.GetModuleMenuItems(this));
        }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:9,代码来源:UserAccountMenu.ascx.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# WebControls.MenuItemCollection类代码示例发布时间:2022-05-26
下一篇:
C# WebControls.MenuEventArgs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap