473,770 Members | 6,506 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Master Pages and Base Pages

Don
I'm using master pages and have added some base functionality (public
functions) into this class.

I then create a new web form using the above as the master page. In the code
of my new web form, I need to access the custom PEMs of the Master page (I've
created).
I find only two ways of doing this (both of which i find unnecessary
replication of code)
- Make use of MasterType directive (which I'd have to do manually for each
and every page I create)
- Type caste the me.Master to the type required using CTYPE or DIRECTCAST or
the like.

Is there any other easier way of achieving the above?
I would've thought that there would be some setting in the web.config which
applies such a setting to all pages!
I'd hate to type either one of the above for each and every page i create
and use!
Sep 12 '06 #1
1 1761
Don,

I personally use the first technique you mention of settting the master type
on each page I create when I need this functionality.

That one little line doesn't seem too outrageous to add to each of my pages
as I create them...

The only other way to do this that I know of would be to inherit from a base
page class in the code behind each time you create a page. That is also only
one line of code, but would also have to be put into each page so setting
the master type seems much easier to me.
Regards,

--
S. Justin Gengo
Web Developer / Programmer

Free code library:
http://www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Don" <Do*@discussion s.microsoft.com wrote in message
news:05******** *************** ***********@mic rosoft.com...
I'm using master pages and have added some base functionality (public
functions) into this class.

I then create a new web form using the above as the master page. In the
code
of my new web form, I need to access the custom PEMs of the Master page
(I've
created).
I find only two ways of doing this (both of which i find unnecessary
replication of code)
- Make use of MasterType directive (which I'd have to do manually for each
and every page I create)
- Type caste the me.Master to the type required using CTYPE or DIRECTCAST
or
the like.

Is there any other easier way of achieving the above?
I would've thought that there would be some setting in the web.config
which
applies such a setting to all pages!
I'd hate to type either one of the above for each and every page i create
and use!

Sep 12 '06 #2

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

Similar topics

14
2406
by: multiformity | last post by:
So I have been working on an opensource project for a while, and decided to really try to make it look better after focusing on the functionality most of this time. Up to now, I have simply used a standard ASPX page with minor modifications to it. All of my pages inherit from a "BasePage.cs" class, that handles common things like getting the user's information out of the session, determines if a page should or should not be password...
1
249
by: yossimotro | last post by:
Hi, I have a server that only supports ASP.NET 1.1, as I understand master pages are available only from version 2.0. What can I use instead that is as elegant as master pages? Thanks, Yossi.
2
1455
by: shapper | last post by:
Hello, I have 2 pages: Page1.aspx and Page2.aspx. The two pages have common design parts but also not common design parts. Is it possible to create something like this: MasterPageA |
1
2057
by: shapper | last post by:
Hello, I am creating a web site with Nested Master pages. I also need to have a class where the culture is set. When the culture is changed by the user the page refreshes and the change takes effect. I saw this approach, I think, on a MSDN web site or blog: Config.vb Class where culture is set from profile value
3
5975
by: Rich | last post by:
Hi, I want to use 2 master pages, one for the main part of the site, the other for the admin pages. They are quite similar, with many shared elements. Ideally I would like to have a parent master page, which both of these child master pages are based on, and in turn the final pages are based on one of these child master pages.
11
1471
by: Just Me | last post by:
I can see master pages being useful if one wants some fragil or complex web design which one does not want to have altered, but thats were it stops as far as I can see. Master Pages Plus 1.) Consistent Design. Master Pages Minus
4
1605
by: Annie | last post by:
Hi guys, I am having a weired situation that don't know how to handle it ... I have master pages, the master page contains a dynaic menu which is set up in the database and has page url, name, title etc. The menu is loaded dynamically at run time. The problem that I have is that once the users are selecting any menu option (eg a link) i should manage to save current page content and
0
1137
by: jgdean14 | last post by:
Hi - We have an Early .NET 2.0 App that was created without Master Pages about a year ago. We opted for more of a MVC framework and dynamically- loaded User Controls. We use Custom User-Controls extensively and are currently researching on refactoring the project (WAP) to use Master Pages. One challenge is the fact that since MasterPages are integrated with content pages in the Init() stage, all of our references to User
6
9160
by: =?Utf-8?B?SmF5IFBvbmR5?= | last post by:
I am trying to access a Public property on a Master Page from a Base Page. On the content pages I have the MasterType Directive set up as follows: <%@ MasterType virtualpath="~/Master.master" %> On the Master Page I have a public property exposed: Public Property ErrorMessage() As String Get Return txtError.InnerText End Get
0
9591
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
10228
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
10057
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
10002
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,...
0
9869
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3970
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
2
3575
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2816
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.