473,666 Members | 2,107 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Programmatic MasterPage access

Is there a way to load a MasterPage programmaticall y? 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 1617
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.MasterPa geFile = "pathHere";

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

*************** *************** *************** ****
Think outside the box!
*************** *************** *************** ****
<ce****@scev.ne twrote in message
news:11******** *************@p 79g2000cwp.goog legroups.com...
Is there a way to load a MasterPage programmaticall y? 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
1098
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: http://msdn.microsoft.com/library/en-us/dnvs05/html/masterpages.asp?frame=false#masterpages_topic11 (Exposing Properties and Methods from a Master Page) here my code:
1
2033
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 the page --%> <div id="footer"> <asp:Label ID="CurrentTimeLabel" runat="server" Text="CurrentTimeLabel"> </div> When the control is not in a ContentPlaceHolder I should be able to access
2
2832
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 a lack of reference to it. How do I supply a reference to the class so that it can populate the label? My code is below... *The reason I am doing it this way, is that I want the typical code used to supply a string to the MasterPage label to be...
6
4161
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 report will be saved as a seperate file. All the user should have to do is press a button to generate the TIFs, without having to "touch the meat" of viewing the report, choosing a file path/name, answering prompts, etc.
3
2080
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, for example, that the Page_Load on the specific page executes before the Page_Load of its MasterPage. Is this right? But what I really want to understand is VARIABLE SCOPE, etc. between the two. For example: Is there a way for me to write code...
2
2529
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 it's intended for)... But now here comes the time where some pages need some processing (like, is the user logged? and those kind of things)... If it was only on 1 or 2 pages, I'd says, i'll put it directly in the code and case closed, but there...
1
1741
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 can I access the public members of the User Control in the MasterPage from the derived page?
4
1824
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 a button called B1 I then have a page called default and in the page load I tryed: System.Web.UI.WebControls.Button B10 = (System.Web.UI.WebControls.Button)Master.FindControl("B1"); System.Web.UI.WebControls.Button B20 =...
4
2187
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
8448
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
8356
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8871
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
8783
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8552
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6198
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
5666
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();...
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
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.