How to finish this property?

A

Andy B

I have the property below. What I need to do is access the asp.net Menu
controls MenuItems in a content page that are on a master page. I need to
set the Enabled state to false when the page loads and re enable it when the
page goes to the next one. Any ideas how to finish this one? Or if I got it
wrong?

//return the main menu so other pages can use it.

public Menu Menu {

get { return MainMenu; }

set { }

}
 
N

Nicholas Paldino [.NET/C# MVP]

Andy,

Perhaps a set property isn't such a good idea? It might be a better
idea to get the menu passed to you through a method and perform your
operations through there.

Are you asking how to access the Menu in the property (through the value
keyword) or are you asking how to set all those properties on the Menu
instance?
 
B

bryan

I don't think you need to accept a Menu from elsewhere ( assumes MainMenu is
contructed in this class). If you have one and return a reference to it,
then the caller of your property can do anything to your menu that they need
to do.

In short- do you NEED a "set"? If you do, then it's set {MainMenu = value;}
 
A

Andy B

I found something for aspx files: <%@ MasterType
VirtualPath="MasterPage.master" %>. The problem is when I run it I have the
following problem: parser error: The file 'MasterPage.master' doesn't exist.
My MasterPage is called Layout.master. Even when I try the virtual path as
the actual file name, it says no circular references allowed. Any ideas why
it doesnt work?

When I get it to work I should be able to do something like:
MasterPageName.MainMenu //whatever to the main menu


Nicholas Paldino said:
Andy,

Perhaps a set property isn't such a good idea? It might be a better
idea to get the menu passed to you through a method and perform your
operations through there.

Are you asking how to access the Menu in the property (through the
value keyword) or are you asking how to set all those properties on the
Menu instance?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Andy B said:
I have the property below. What I need to do is access the asp.net Menu
controls MenuItems in a content page that are on a master page. I need to
set the Enabled state to false when the page loads and re enable it when
the page goes to the next one. Any ideas how to finish this one? Or if I
got it wrong?

//return the main menu so other pages can use it.

public Menu Menu {

get { return MainMenu; }

set { }

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top