Pini,
Yes, master pages can be used the way you want. No, I don't think they are a
complete substitute for page inheritance, but they get very very close.
If you put this line in the source code view of the .aspx template file:
<%@ MasterType VirtualPath="~/MasterPage.mast er" %>
You will then have access to any method you've placed into the master page's
code behind. For example if you place a subroutine for logging exceptions
that takes a string description and the exception itself as parameters on
your master page, you could then call it from your template like this:
Call Master.ProcessE xception("There was an error on page load:", ex)
Thus giving you the same access to common functionality that page
inheritance would have given you.
Regards,
--
S. Justin Gengo
Web Developer / Programmer
Free code library:
http://www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"Pini" <ia*********@ya hoo.comwrote in message
news:11******** **************@ h48g2000cwc.goo glegroups.com.. .
Hi there Justin and thanks for your reply.
First of all i do know about master pages, bus i dont think they are a
subtitued for Page inheritance.All they do is provide a template and
the same look and feel in all of the pages, please correct me if i am
wrong.
I want to find a way to give all my pages some functionality and not
just the same look and feel.
Is there a way to do this in asp.net.2.0 ?
Do you mean master pages replaces the inheritance "trick"?
S. Justin Gengo ???:
Pini,
In .NET 2.0 there is an easier way to get the same functionality. You can
create a master page. Then use that master page for each new page. In the
new page's html code view you can then add a Master Type directive which
will then let you use any code from the master page.
Here's a how-to:
http://odetocode.com/Blogs/scott/arc...7/16/1944.aspx
Regards,
--
S. Justin Gengo
Web Developer / Programmer
Free code library:
http://www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"Pini" <ia*********@ya hoo.comwrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.com.. .
Hi all,In asp.net 1.x i creates a basepage that extends
System.Web.UI.P age class.
I created this file in a web appplcaition project and then refernced it
from another projects.
All the pages in this project inherited from this new BasePage ionstead
of the Page class.
In asp.net 2.0 i dont seem to make this work.
I did the same thing. precompile the project and then added refernce to
the assemblies in the precompiled directory.
It doesnt seem to work since i put a break point at the Page_Load event
and others in the base class and it doesnt seem to reach there.
What shoul i do?
by the way if i put the basepage in the App_Code direcotry - it doent
evenrecognice this base class.(No namespace problem)
anyone?