473,399 Members | 3,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 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 1744
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.