Using Master Pages and Base Pages

G

Guest

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!
 
S

S. Justin Gengo

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top