Content Not Rendering in Master Page

G

Guest

Hi,

I have a master page, with a single content placeholder.

I create a content page for it with some appropriate content. At this point
everything is working fine.

However I need to change the type of my content page to use my own BasePage
class that contains a lot of code for handling resources and web service
calls. The PageBase class inherits from System.Web.UI.Page.

This a cutdown version with all my extra code removed.

public class PageBase: System.Web.UI.Page
{
protected override void OnInit(EventArgs e)
{
if (this.Master != null)
{
//prevents ASP.Net from shoving ctl001 in front of all my
tag ID's.
this.Master.ID = "demo";
}
base.OnInit(e);
}
}

So my content page code-behind looks like this:

public partial class contentPage: PageBase
{
....
}

Everything compiles fine.

When I load the content page and debug, all my code runs. In the browser the
title is set appropriately and other data-driven changes to the master page
are visible. However the content in the contentplaceholder does not render.

What happens when I inherit from System.Web.UI.Page that causes the content
page to no longer render?

Any thoughts?

GTB
 
C

Craig

Hi,

I have the same exact problem.
I figured out that it is cause because they way we're accesing the master
page.
I think that is not the correct way, though, I don't know what's the right
way either.
I'm gonna investigate more on this and post my findings.

Regards,
 

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,968
Messages
2,570,150
Members
46,697
Latest member
AugustNabo

Latest Threads

Top