472,953 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,953 software developers and data experts.

MasterPages and Variables

Hi,
I have a Masterpage that controls the basic layout of the pages displayed
on a web site. The masterpage also uses some variables. I would like to be
able to access some of these variables from the content pages. Can this be
done and if so how. I have made the Varibles that I wish to access Public
Members.

Thanks for any help.
Kenneth
Nov 19 '05 #1
6 1722
You should add the <%@ MasterType VirtualPath="YourMaster.master" %> to your
ASPX pages.

http://beta.asp.net/QUICKSTART/aspne...ault.aspx#code

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi,
I have a Masterpage that controls the basic layout of the pages
displayed
on a web site. The masterpage also uses some variables. I would like
to be
able to access some of these variables from the content pages. Can
this be done and if so how. I have made the Varibles that I wish to
access Public Members.

Thanks for any help.
Kenneth


Nov 19 '05 #2
Thanks for the help.
That was what I was looking for.

"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:11***********************@msnews.microsoft.co m...
You should add the <%@ MasterType VirtualPath="YourMaster.master" %> to your ASPX pages.

http://beta.asp.net/QUICKSTART/aspne...ault.aspx#code

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi,
I have a Masterpage that controls the basic layout of the pages
displayed
on a web site. The masterpage also uses some variables. I would like
to be
able to access some of these variables from the content pages. Can
this be done and if so how. I have made the Varibles that I wish to
access Public Members.

Thanks for any help.
Kenneth


Nov 19 '05 #3
Hi,
I have given this a go but I am still having problems with my code
generated variables. I have a master page that checks the authenication
ticket to see who is logged in. I then want to store the information about
the logged in user in variables. the content pages then need to be able to
access the variables to enable the content pages to change based ono the
logged in user details.
Can I make this happen and if so How do I do it.
Thanks
Kenneth

"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:11***********************@msnews.microsoft.co m...
You should add the <%@ MasterType VirtualPath="YourMaster.master" %> to your ASPX pages.

http://beta.asp.net/QUICKSTART/aspne...ault.aspx#code

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi,
I have a Masterpage that controls the basic layout of the pages
displayed
on a web site. The masterpage also uses some variables. I would like
to be
able to access some of these variables from the content pages. Can
this be done and if so how. I have made the Varibles that I wish to
access Public Members.

Thanks for any help.
Kenneth


Nov 19 '05 #4
You need to make the members public on the Master page. So in the Master
code (either inline in .master in <script runat=server> or in codebehind:

string _address;

public string UserAddress
{
get { return _address; }
}

But given whet you described, I'd suggst doing it differently. Instead consider
just having a seperate class (perhaps in App_Code) with all static methods/properties
like "CurrentUserAddress" that does the lookup dynamically (based upon HttpContext.Current.User.Identity.Name)
and caches the results in the ASP.NET data Cache. This was any page, control
or master can call into the API and you're ont dependant upon using a particular
master page to do this work.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi,
I have given this a go but I am still having problems with my code
generated variables. I have a master page that checks the
authenication
ticket to see who is logged in. I then want to store the information
about
the logged in user in variables. the content pages then need to be
able to
access the variables to enable the content pages to change based ono
the
logged in user details.
Can I make this happen and if so How do I do it.
Thanks
Kenneth
"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:11***********************@msnews.microsoft.co m...
You should add the <%@ MasterType VirtualPath="YourMaster.master" %>
to

your
ASPX pages.

http://beta.asp.net/QUICKSTART/aspne...efault.aspx#co
de

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi,
I have a Masterpage that controls the basic layout of the pages
displayed
on a web site. The masterpage also uses some variables. I would like
to be
able to access some of these variables from the content pages. Can
this be done and if so how. I have made the Varibles that I wish to
access Public Members.
Thanks for any help.
Kenneth


Nov 19 '05 #5
Thanks for the idea, could you supply a small sample of the code to show how
this is done. I am still fairly new to C# and ASP.Net.
Thanks again
Kenneth
"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:11***********************@msnews.microsoft.co m...
You need to make the members public on the Master page. So in the Master
code (either inline in .master in <script runat=server> or in codebehind:

string _address;

public string UserAddress
{
get { return _address; }
}

But given whet you described, I'd suggst doing it differently. Instead consider just having a seperate class (perhaps in App_Code) with all static methods/properties like "CurrentUserAddress" that does the lookup dynamically (based upon HttpContext.Current.User.Identity.Name) and caches the results in the ASP.NET data Cache. This was any page, control or master can call into the API and you're ont dependant upon using a particular master page to do this work.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi,
I have given this a go but I am still having problems with my code
generated variables. I have a master page that checks the
authenication
ticket to see who is logged in. I then want to store the information
about
the logged in user in variables. the content pages then need to be
able to
access the variables to enable the content pages to change based ono
the
logged in user details.
Can I make this happen and if so How do I do it.
Thanks
Kenneth
"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:11***********************@msnews.microsoft.co m...
You should add the <%@ MasterType VirtualPath="YourMaster.master" %>
to

your
ASPX pages.

http://beta.asp.net/QUICKSTART/aspne...efault.aspx#co
de

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi,
I have a Masterpage that controls the basic layout of the pages
displayed
on a web site. The masterpage also uses some variables. I would like
to be
able to access some of these variables from the content pages. Can
this be done and if so how. I have made the Varibles that I wish to
access Public Members.
Thanks for any help.
Kenneth


Nov 19 '05 #6
I'd suggest looking at the quickstarts to get you going:

http://beta.asp.net/QUICKSTART/aspne...s/default.aspx

-Brock
DevelopMentor
http://staff.develop.com/ballen
Thanks for the idea, could you supply a small sample of the code to
show how
this is done. I am still fairly new to C# and ASP.Net.
Thanks again
Kenneth
"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:11***********************@msnews.microsoft.co m...
You need to make the members public on the Master page. So in the
Master code (either inline in .master in <script runat=server> or in
codebehind:

string _address;

public string UserAddress
{
get { return _address; }
}
But given whet you described, I'd suggst doing it differently.
Instead

consider
just having a seperate class (perhaps in App_Code) with all static

methods/properties
like "CurrentUserAddress" that does the lookup dynamically (based
upon

HttpContext.Current.User.Identity.Name)
and caches the results in the ASP.NET data Cache. This was any page,

control
or master can call into the API and you're ont dependant upon using a

particular
master page to do this work.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi,
I have given this a go but I am still having problems with my code
generated variables. I have a master page that checks the
authenication
ticket to see who is logged in. I then want to store the information
about
the logged in user in variables. the content pages then need to be
able to
access the variables to enable the content pages to change based ono
the
logged in user details.
Can I make this happen and if so How do I do it.
Thanks
Kenneth
"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:11***********************@msnews.microsoft.co m...
You should add the <%@ MasterType VirtualPath="YourMaster.master"
%> to

your

ASPX pages.

http://beta.asp.net/QUICKSTART/aspne.../default.aspx#
co de

-Brock
DevelopMentor
http://staff.develop.com/ballen
> Hi,
> I have a Masterpage that controls the basic layout of the pages
> displayed
> on a web site. The masterpage also uses some variables. I would
> like
> to be
> able to access some of these variables from the content pages. Can
> this be done and if so how. I have made the Varibles that I wish
> to
> access Public Members.
> Thanks for any help.
> Kenneth


Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Roger Walter | last post by:
When using the MasterPages form Templating from ASP.NET web Controls, and also using another templating process that uses User Controls, I get a border around the entire page when it is rendered...
1
by: nLella | last post by:
I am trying to build a new web application and trying to implement either templates or master pages in it. I tried to read several articles but could not actually deside on weather to go with the...
3
by: Lars W. Andersen | last post by:
Hi, I am looking for a good - easy to comprehend little CMS application for my "beginners" asp.net 2.0 site. It must be able to use Access as the database (only a couple of people will be...
2
by: iturner100 | last post by:
Hi, I've been struggling with this one for a couple of hours without much joy. Basically, I've got a set of nested masterpages (3 as it happens). I'm dynamically generating a new page in code...
5
by: Nick Wouters | last post by:
Dear All In Classic ASP I used CSS for ALL layout. Now in ASP.NET version 2 I am testing out Masterpages as they come in very handy. It seems like it is replacing CSS for layout but what is...
2
by: Thiery Balser | last post by:
Hi Everybody! I'm stuck with the following problem: I have a couple of pages which has all the same 'header', i.e. some common elements. So far I realized that the best thing would be to use...
0
by: Swami | last post by:
I have 2 questions relating to website design in asp .net: 1. In a website that I am building I have everything as a user control. Even the header, which contains the navigation tabs is in a user...
6
by: =?Utf-8?B?U3RlcGhlbiBIYXRmaWVsZA==?= | last post by:
I have two masterpages in a web application. One is used for the login and logout pages. The other is used for all other pages in the application. The difference between the two masterpages is...
8
by: Mort Strom | last post by:
Right now the header of my master page contains all of the CSS styles for all of the pages that might be loaded in my ContentPlaceHolder. The problem is that my <styletag is getting too large to...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.