Just wrote about this. Rather than redo the entire article, here's the
link:
http://blog.dmbcllc.com/2007/11/05/how-to-properly-access-controls-in-th
e-master-page/
It talks about accessing a TD in the master page from the aspx page.
You could do something similar to set your menu. We do it all the time.
Even have one app where the background color of the screen changes based
on the page you are on.
-----Original Message-----
From: Mark Rae [MVP] [mailto:
[email protected]]
Posted At: Monday, November 05, 2007 11:27 AM
Posted To: microsoft.public.dotnet.framework.aspnet
Conversation: Checking to see what page is loaded from inside a master
page file?
Subject: Re: Checking to see what page is loaded from inside a master
page file?
Is there a way you can test what page is loaded from inside a master page?
What I need to do is test to see what page is loaded inside the master
page and then gray out the root item linked to that page in the Menu
control. I.e. I have a root item called home. When a person is on the home
page I want it to be disabled. Any way to do this?
You're confusing MasterPages with framesets...
A MasterPage doesn't load the content page - it's the other way round...
When a content page loads, it interrogates its MasterPage property and
then
combines itself with it to create a single page. In fact, a MasterPage
is
just a UserControl...
It's simple enough to get a content page to modify its MasterPage,
however -
you can create a property on the MasterPage for the content page to set,
or
you can do something like:
((Menu)this.Master.FindControl("MyMenu"))........