From: Jeff on
Hi all,

I have added a menu control on my Masetr Page, I added the links that I
wanted to add, Question is I would like some of those links to either not be
visable on certain pages or at the very least not be enabled for navigation
untill the user has gone to a certain page to say log in and then those
links become enabled or visable. I have not been able to figure out how to
refer to the menu control located on the maser page from the other pages in
the site? I am sure it is something easy but I just have not figured out
how to accomplish this yet.

I tried a work around by just adding another menu item on the page i want
the new navigation link to show up on, althoug it works it is not such a
good solution as trying to line it up correctly with the other links etc...

any help would be greatly appreaciated,

Thanks,

Jeff


From: Mark Rae [MVP] on
"Jeff" <jeffby(a)nospamtds.net> wrote in message
news:HP%yn.333$Sp1.223(a)newsreading01.news.tds.net...

> 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");


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

From: Jeff on
Hi Mark,

Thanks for the response. Now i guess I will show my lack of knowledge even
further now by saying I do not really understand this

Menu mnuMaster = (Menu)Master.FindControl("mnuMenu");

Here is what I believe I am understanding

Menu mnuMaster - I am creating a new instance of a menu

("mnuMenu"); - This should be the name of the menu control on the master
page

(Menu)Master.FindControl - This is the part that is going to the mater page
to get a copy of the menu control?

Ok so on my Master page I have a menu Control mnuMenu1 and it has 4 menu
items Home; CreateUser ; SearchPage; Contact Us

I am not wanting the SearchPage menu item to visible and/or enabled until
after they go to the CreateUser page

so after successful completion of creating a user name the SearchPage menu
item should become visible and/or enabled

I put the line of code in that you gave as Menu mnuMyNewMenu =
(Menu)Master.FindControl("mnuMenu1");

No errors given there but just trying some thing simple to see if i could
get it working I tried mnuMyNewMenu.Visible = false;

It did not like that, it threw an exception error so I guess I am still not
understanding just how this works to access the menu / menu items.?

Thanks,

Jeff


"Mark Rae [MVP]" <mark(a)markrae.net> wrote in message
news:OC3yLJ%233KHA.3352(a)TK2MSFTNGP02.phx.gbl...
> "Jeff" <jeffby(a)nospamtds.net> wrote in message
> news:HP%yn.333$Sp1.223(a)newsreading01.news.tds.net...
>
>> 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");
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net


From: Jeff on
Ok,
I had a typo on the first part, so I am now able to make my whole menu
..visable = false and that works the navigation menu disapears, 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 equivilent?

Thanks, Jeff

"Mark Rae [MVP]" <mark(a)markrae.net> wrote in message
news:OC3yLJ%233KHA.3352(a)TK2MSFTNGP02.phx.gbl...
> "Jeff" <jeffby(a)nospamtds.net> wrote in message
> news:HP%yn.333$Sp1.223(a)newsreading01.news.tds.net...
>
>> 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");
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net


From: Mark Rae [MVP] on
"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