Portal Engine
Version 2.x > Portal Engine > ASP.NET master pages View modes: 
User avatar
Member
Member
persun - 11/14/2006 6:42:03 PM
   
ASP.NET master pages
Previous posts seem to indicate that it possible to use ASP.NET master pages within Kentico CMS 2.0 Is this a documented feature? If not, can someone describe the proper way of incorporating master pages in Kentico?

(I am evaluating Kentico and trying to figure out what my options are)

Thanks,

Per

User avatar
Member
Member
gvspm - 11/15/2006 5:12:42 PM
   
Re: ASP.NET master pages
Im stuck too.

I want to build templates for my complex portal on base of .aspx files.

How can i insert a CMSWebPartZone ?
How can i combine WebParts and custom .aspx templates?

I always get the error "Parent CMSPagePlaceholder not found".

We desperately need some documentation about the CMSPages/PortalTemplate.aspx.

User avatar
Guest
admin - 11/16/2006 9:11:19 AM
   
Re: ASP.NET master pages
Hello,

we currently recommend that you build the pages using the portal engine model as explained in the Kentico CMS Tutorial since it will allow you to use all new features of Kentico CMS in future. This model supports the philosophy of master pages - the root page is the master page for all web pages and sub-pages always inherit content from their parent pages (unless you configure them otherwise).

Please let me know if I can be of any further assistance.

Best Regards,

User avatar
Member
Member
gvspm - 11/16/2006 10:09:21 AM
   
Re: ASP.NET master pages
Hello,

thanks for your explanation and yes, i can switch away form classic asp.net master pages and use kentico's philosophy of master pages. I like this approach very much!

<preface>
I started to build our new portal with Kentico 1.9 (demo). Now i try to migrate to 2.0 (demo for now)
In 1.9 i wrote my code logic directly in the .aspx template and this In my eyes, allowed me to easely debug it in vs2005.
But now i have to separate all my code in nice Webparts, and i am facing a steep learning curve.
</preface>

So, in a WebPart, how can i access the head ?

You suggested in post <a href="http://www.kentico.com/Forums/ShowPost.aspx?PostID=2151">Post 2151 - Modifying the <head> tag</a> to modify the CMSPages\PortalTemplate.aspx page.
But this affects every page derived from it.
I heavely relay on client side scripting (Jscript),
and don't want to include all .js in every page.

I found this way:

1) in CMSPages\PortalTemplate.aspx add an ID to the <head> tag:
<code>
<head runat="server" id="Head">
</code>

2) in your WebPart configuration in the CODE tab add following:
<code>
<script runat="server">
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
HtmlContainerControl head = (HtmlContainerControl) Page.FindControl("Head");
if (null != head)
{
Literal lit = new Literal();
lit.Text = "<meta mymeta=mydata />";
head.Controls.Add(lit);
}
}
</script>
</code>

Now can i include my .js files only in those pages, with my WebParts on it.

What do you think about it? Is this "clean" enough? Is there an easyer way?

greetings
Martin

User avatar
Guest
admin - 11/16/2006 10:34:45 AM
   
Re: ASP.NET master pages
Thank you for your message. Yes, this is a good solution. We will add a new web part for adding JavaScript (directly or linked) into the pages in version 2.1 so that it's more straightforward.

Best Regards,

User avatar
Guest
admin - 12/5/2006 6:48:18 PM
   
Re: ASP.NET master pages
Hello,

Thank you for your messages. The ASPX page templates will be fully supported and documented in version 2.1. We have decided to follow the feedback of our clients and keep the full support for ASPX page template development.

Best Regards,