Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Using Master Pages and Base Pages

Reply
Thread Tools

Using Master Pages and Base Pages

 
 
=?Utf-8?B?RG9u?=
Guest
Posts: n/a
 
      09-12-2006
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!
 
Reply With Quote
 
 
 
 
S. Justin Gengo
Guest
Posts: n/a
 
      09-12-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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!



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Referencing UserControl on a master page when using a Base class for all pages SMH ASP .Net 0 05-07-2009 12:44 PM
Using update panel with master & nested master pages katmagic ASP .Net 0 12-26-2008 07:41 PM
Cross Page Post Back When Using Mixture of Master Pages and Non-Master Pages Jason@webbit.com ASP .Net 1 05-16-2006 02:00 PM
Master Pages Great! But what about Master User Controls? Electrified Research ASP .Net 5 10-11-2005 02:32 PM
seeking servlet "Master" keep getting "Master/servlet/Master" not found. Tomcat 5.0.25 Doug McCann Java 1 08-05-2004 09:16 PM



Advertisments