469,890 Members | 1,440 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,890 developers. It's quick & easy.

asp.net 2.0 creating a base page

Hi all,In asp.net 1.x i creates a basepage that extends
System.Web.UI.Page 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?

Sep 12 '06 #1
3 1817
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*********@yahoo.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
Hi all,In asp.net 1.x i creates a basepage that extends
System.Web.UI.Page 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?

Sep 12 '06 #2
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*********@yahoo.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
Hi all,In asp.net 1.x i creates a basepage that extends
System.Web.UI.Page 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?
Sep 13 '06 #3
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.master" %>

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.ProcessException("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*********@yahoo.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.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*********@yahoo.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
Hi all,In asp.net 1.x i creates a basepage that extends
System.Web.UI.Page 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?

Sep 15 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by jen_designs | last post: by
12 posts views Thread by Mats Lycken | last post: by
3 posts views Thread by Tabi | last post: by
15 posts views Thread by David Thielen | last post: by
3 posts views Thread by Allan Ebdrup | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.