473,748 Members | 6,418 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1767
You should add the <%@ MasterType VirtualPath="Yo urMaster.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****@NOSPAMd evelop.com> wrote in message
news:11******** *************** @msnews.microso ft.com...
You should add the <%@ MasterType VirtualPath="Yo urMaster.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****@NOSPAMd evelop.com> wrote in message
news:11******** *************** @msnews.microso ft.com...
You should add the <%@ MasterType VirtualPath="Yo urMaster.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 "CurrentUserAdd ress" that does the lookup dynamically (based upon HttpContext.Cur rent.User.Ident ity.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****@NOSPAMd evelop.com> wrote in message
news:11******** *************** @msnews.microso ft.com...
You should add the <%@ MasterType VirtualPath="Yo urMaster.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****@NOSPAMd evelop.com> wrote in message
news:11******** *************** @msnews.microso ft.com...
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 "CurrentUserAdd ress" that does the lookup dynamically (based upon HttpContext.Cur rent.User.Ident ity.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****@NOSPAMd evelop.com> wrote in message
news:11******** *************** @msnews.microso ft.com...
You should add the <%@ MasterType VirtualPath="Yo urMaster.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****@NOSPAMd evelop.com> wrote in message
news:11******** *************** @msnews.microso ft.com...
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 "CurrentUserAdd ress" that does the lookup dynamically (based
upon

HttpContext.Cur rent.User.Ident ity.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****@NOSPAMd evelop.com> wrote in message
news:11******** *************** @msnews.microso ft.com...
You should add the <%@ MasterType VirtualPath="Yo urMaster.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
1550
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 to the browser. Do you know how I can get rid of this. My template has a header, sides, main body, and footer, and around all of this is this border. Even in VS during design, I can not move the user control or MasterPages Container into this...
1
1621
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 template approach(http://forums.asp.net/ShowPost.aspx?PageIndex=6&PostID=4692#66176) or with The masterpages approach(http://www.asp.net/ControlGallery/ControlDetail.aspx?Control=385) Can you please suggest me which one to use and why?
3
1780
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 posting and editing news articles). I use masterpages so it needs to be able to publish content in the ContentPlaceholder server controls.
2
2467
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 and want to be able to populate the ContentPlaceholders of the inner-most masterpage at run-time.
5
4319
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 the best choise? 1) Using Masterpages with Themes (css / images / skins included in this theme)
2
2289
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 master pages. This is all fine and works. Now, there are certain variables stored in the session object which I would
0
1438
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 control which is placed on every page. Originally, the reason why I chose to do it this way (instead of placing the header in a master page) is because my header tabs change dynamically based on who the user is. My question is, am I losing...
6
1978
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 that on the main one I have a user control in the left side that has the site navigation menu while the login/logout masterpage has a non-breaking space in that table cell. Everything else is exactly the same. The issue is that the login/logout...
8
11790
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 manage. I have 300 lines of styles in my masterpage and I don't need all of this for every page -- somehow this can't be a smart way of managing styles. How do I programmatically apply styles in my MasterPage based on the ContentPlaceHolder...
0
8987
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9534
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8239
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6793
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4597
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2211
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.