Create a new Page

Jan 13, 2011 at 4:05 PM

How do I create a page.aspx so that it inherits the theme of the blog? I can not do it 
because each theme has a  mastepage, how I do I to make this page use the master page 
of the theme?

 

Thanks

Coordinator
Jan 13, 2011 at 4:09 PM

Your page (code behind file) have to inherit from blog base, like so:

public partial class archive : BlogEngine.Core.Web.Controls.BlogBasePage

Jan 13, 2011 at 5:23 PM

I'm try it but receive de folowing error

 

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 


[HttpException (0x80004005): Content controls have to be top-level controls in a content page or a nested master page that references a master page.]
   System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +8673240
   System.Web.UI.Page.get_Master() +51
   System.Web.UI.Page.ApplyMasterPage() +15
   System.Web.UI.Page.PerformPreInit() +45
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +282

 

Jan 13, 2011 at 8:13 PM

up

Coordinator
Jan 13, 2011 at 9:56 PM

You using master page, so you need to throw away all generated HTML in .aspx file and add content placeholder instead. For example:

<asp:Content ID="Content1" ContentPlaceHolderID="cphBody" Runat="Server">
    <div>hello world</div>
</asp:Content>
There are bunch of pages in the root directory that do it, archive, contact etc. - take a look at them if run into issue. One mandatory thing is that placeholder must be named "cpBody" - base class expects to find it.

Jan 13, 2011 at 10:05 PM

You could try this:

Add new item - Web Form using Master Page (could be done in another project)

manually editting *.aspx file remove MasterPage attribute and make the page to inherit from BlogbasePage.