From: Jeff on 19 Apr 2010 17:26 "Mark Rae [MVP]" <mark(a)markrae.net> wrote in message news:5D137E90-8A04-46B3-A7AA-A9836370D6C9(a)microsoft.com... > "Jeff" <jeffby(a)nospamtds.net> wrote in message > news:Fw2zn.335$Sp1.40(a)newsreading01.news.tds.net... > > [please don't top-post] > >>>> I have not been able to figure out how to refer to the menu control >>>> located on the MasterPage from the other pages in the site? >>> >>> Menu mnuMaster = (Menu)Master.FindControl("mnuMenu"); >> >> I had a typo on the first part, so I am now able to make my whole menu >> .Visible = false and that works the navigation menu disappears, but I can >> not figure out how to get to the menu items such as SearchPage? >> >> In VB i could access the menu item by menu1.Items(2).enabled = false and >> that would make the menu item at index 2 disabled but that does not work >> in C# is there something that is equivalent? > > Menu mnuMaster = (Menu)Master.FindControl("mnuMenu1"); > mnuMaster.Items[2].Enabled = false; > > > > -- > Mark Rae > ASP.NET MVP > http://www.markrae.net Thanks again Mark, That did the trick, I also found a way by doing this, Menu mnuMyNewMenu = (Menu)Master.FindControl("mnuMasterNavigation"); mnuMyNewMenu.FindItem("Home").Enabled = false; and also how to add a link if I want. MenuItem Test = new MenuItem("Test"); mnuMyNewMenu.Items.Add(Test); mnuMyNewMenu.FindItem("Test").NavigateUrl = "Default.aspx"; Thanks again for the help!! Jeff
From: Mark Rae [MVP] on 19 Apr 2010 18:03 "Jeff" <jeffby(a)nospamtds.net> wrote in message news:gU3zn.337$Sp1.245(a)newsreading01.news.tds.net... > MenuItem Test = new MenuItem("Test"); > mnuMyNewMenu.Items.Add(Test); > mnuMyNewMenu.FindItem("Test").NavigateUrl = "Default.aspx"; Or even simpler: MenuItem Test = new MenuItem("Test"); Test.NavigateUrl = "Default.aspx"; mnuMyNewMenu.Items.Add(Test); -- Mark Rae ASP.NET MVP http://www.markrae.net
First
|
Prev
|
Pages: 1 2 Prev: CMS and C#? Next: Upgrading Microsoft Report Viewer from 2008 to 2010 |