I am on a team that is developing a proposal generation web application and
we are using a custom base page (ProGenBase.cs) located in the app_code dire
ctory and all of the app's web pages inherit from this custom page. Addition
ally I have a main menu tab control that is located in a master page and cer
tain tabs are displayed dependant on the users authentication level. I am us
ing boolean properties in the master page to control the visible state of th
e tabs. I have code in each web page that checks the users authentication le
vel and depending on what the level is sets the master page visible property
to true or false respectively.
What I would like to do is move this code to the base page so the code is lo
cated in just one place and isn't being replicated in multiple pages - the o
ld issue of if the code needs to be changed for whatever reason I'll only ha
ve to do it in one place vice multiple places (and hope that I got all of th
e pages). My problem is that I don't know how to access my master page prope
rties from the base page class that is located in the app_code directory bei
ng that this is my first major .net 2.0 project.
Any help/tricks/tips/suggestions will be greatly appreciated.
TIA,
Bill Youngmanthe master page should implement an interfase. the the base page can
cast the master to this interface and access methods.
-- bruce (sqlwork.com)
William Youngman wrote:
> I am on a team that is developing a proposal generation web application
> and we are using a custom base page (/ProGenBase.cs/) located in the
> app_code directory and all of the app's web pages inherit from this
> custom page. Additionally I have a main menu tab control that is located
> in a master page and certain tabs are displayed dependant on the users
> authentication level. I am using boolean properties in the master page
> to control the visible state of the tabs. I have code in each web page
> that checks the users authentication level and depending on what the
> level is sets the master page visible property to true or false
> respectively.
> What I would like to do is move this code to the base page so the code
> is located in just one place and isn't being replicated in multiple
> pages - the old issue of if the code needs to be changed for whatever
> reason I'll only have to do it in one place vice multiple places (and
> hope that I got all of the pages). My problem is that I don't know how
> to access my master page properties from the base page class that is
> located in the /app_code/ directory being that this is my first
> major .net 2.0 project.
> Any help/tricks/tips/suggestions will be greatly appreciated.
> TIA,
> Bill Youngman
The quick answer is public properties. Read the first item returned by
submitting the following search term to google...
reference masterpage site:msdn2.microsoft.com
Then go to http://odetocode.com/ where you'll find K. Scott Allen has
documented what can be considered the definitive study of the use of
MasterPages.
<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/
"William Youngman" <wyoungman@.brinkercapital.com> wrote in message
news:OqOhpwUbHHA.5044@.TK2MSFTNGP05.phx.gbl...
I am on a team that is developing a proposal generation web application and
we are using a custom base page (ProGenBase.cs) located in the app_code
directory and all of the app's web pages inherit from this custom page.
Additionally I have a main menu tab control that is located in a master page
and certain tabs are displayed dependant on the users authentication level.
I am using boolean properties in the master page to control the visible
state of the tabs. I have code in each web page that checks the users
authentication level and depending on what the level is sets the master page
visible property to true or false respectively.
What I would like to do is move this code to the base page so the code is
located in just one place and isn't being replicated in multiple pages - the
old issue of if the code needs to be changed for whatever reason I'll only
have to do it in one place vice multiple places (and hope that I got all of
the pages). My problem is that I don't know how to access my master page
properties from the base page class that is located in the app_code
directory being that this is my first major .net 2.0 project.
Any help/tricks/tips/suggestions will be greatly appreciated.
TIA,
Bill Youngman
I was able to accomplish what I needed by moving the objects into user contr
ols and creating a couple of interfaces for them as well as creating a maste
r page base class and having my master page inherit from that.
I want to thank those who replied for their suggestions - they were very hel
pful. Also if anybody stumbles across this page while searching for solution
s to the same issue I found this article on SitePoint that was invaluable-
Master Pages hate logic. Throw Interfaces at them
http://www.sitepoint.com/blogs/2006...
at-them
"William Youngman" <wyoungman@.brinkercapital.com> wrote in message news:OqOh
pwUbHHA.5044@.TK2MSFTNGP05.phx.gbl...
I am on a team that is developing a proposal generation web application and
we are using a custom base page (ProGenBase.cs) located in the app_code dire
ctory and all of the app's web pages inherit from this custom page. Addition
ally I have a main menu tab control that is located in a master page and cer
tain tabs are displayed dependant on the users authentication level. I am us
ing boolean properties in the master page to control the visible state of th
e tabs. I have code in each web page that checks the users authentication le
vel and depending on what the level is sets the master page visible property
to true or false respectively.
What I would like to do is move this code to the base page so the code is lo
cated in just one place and isn't being replicated in multiple pages - the o
ld issue of if the code needs to be changed for whatever reason I'll only ha
ve to do it in one place vice multiple places (and hope that I got all of th
e pages). My problem is that I don't know how to access my master page prope
rties from the base page class that is located in the app_code directory bei
ng that this is my first major .net 2.0 project.
Any help/tricks/tips/suggestions will be greatly appreciated.
TIA,
Bill Youngman
Saturday, March 31, 2012
Setting master page properties from custom base page
Labels:
app_code,
application,
asp,
base,
custom,
developing,
generation,
located,
master,
net,
page,
progenbase,
properties,
proposal,
setting,
team,
web
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment