473,398 Members | 2,393 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,398 software developers and data experts.

Programmatic MasterPage access

Is there a way to load a MasterPage programmatically? Not switch a
page's masterpage but to create a MasterPage object that holds a given
masterpage. So I know I can do:

MasterPage master = new MasterPage();

But there is no way to do something like:

MasterPage master = new MasterPage("~/default.master");

So how does one create an instance of a given MasterPage???

Aug 16 '06 #1
4 1602
See this one...
http://odetocode.com/Articles/450.aspx
--
Brad

"Software is like melted pudding..."
Aug 16 '06 #2
Have not tried, but something like:

MasterPage master = new MasterPage();
master.MasterPageFile = "pathHere";

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside the box!
*************************************************
<ce****@scev.netwrote in message
news:11*********************@p79g2000cwp.googlegro ups.com...
Is there a way to load a MasterPage programmatically? Not switch a
page's masterpage but to create a MasterPage object that holds a given
masterpage. So I know I can do:

MasterPage master = new MasterPage();

But there is no way to do something like:

MasterPage master = new MasterPage("~/default.master");

So how does one create an instance of a given MasterPage???

Aug 16 '06 #3
That is an excellent site I spent a bit of time on there some months
back. But I did not see how to load and interact a MasterPage, just
how to assign a MasterPage etc. in the regular Page processing
lifecycle. If you saw something that displays what I am looking for
can you provide a more info please?

Thank you

Brad Roberts wrote:
See this one...
http://odetocode.com/Articles/450.aspx
--
Brad

"Software is like melted pudding..."
Aug 17 '06 #4
I don't want to be pushy but I imagine that someone else has had to do
or try and do this. Any direction would be great!!!

Thank you.

Aug 18 '06 #5

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

Similar topics

0
by: Tony | last post by:
Hi, I'm trying to access properties from a masterpage. With no success. Can somebody help me please? I used the example at:...
1
by: clintonG | last post by:
I'm having a problem with a label in a MasterPage which is not in a ContentPlaceHolder. The naughty label will not allow me to change its text property. <%-- renders the label's text directly to...
2
by: dawg1998 | last post by:
I am trying to access a label located in a MasterPage from a class located in my application's App_Code folder. The problem seems to be that the class cannot communicate with the MasterPage due to...
6
by: Blaine Manyluk | last post by:
I have a very unusual request. I need to be able to generate reports and save them as TIF files, with full programmatic control. The application will provide the filenames. Each page of the...
3
by: Alex Maghen | last post by:
Hi. I'm a little confused about the code that resides in the code-behind of a MasterPage and the code that resides in the code-behind of the actual pages that USE that MasterPage. I'm noticing,...
2
by: ThunderMusic | last post by:
Hi, Maybe there is another way of doing this, but here's my problem... I have my web site where I have a master page to have a common layout and a common behavior on all my pages (that's what...
1
by: zb | last post by:
Here is the scenario: I have a page derived from a MasterPage. The MasterPage has a user control that exposes two properties that as public and can be used by other objects. Question: How...
4
by: Torben Laursen | last post by:
I want to change the label of a component that I have on a masterpage but I cannot get my hands on it I have a mastepage MP2 that has a button called B2 masterpage MP2 uses masterpage MP1 that has...
4
by: =?Utf-8?B?SmFwZQ==?= | last post by:
Can I refer to the controls on default.aspx from the masterpage? I have a form on the masterpage which sends information that is in a gridview in the default.aspx page.
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
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,...
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
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,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.