ASPX templates
Version 5.x > ASPX templates > Modifying DocType, XmlNamespace, HeaderTags, etc. in the ASPX Template View modes: 
User avatar
Member
Member
raleigh.buckner-erwinpenland - 3/13/2011 11:25:12 PM
   
Modifying DocType, XmlNamespace, HeaderTags, etc. in the ASPX Template
I am using the guide in the documentation for creating a master page using the ASPX template engine (http://www.kentico.com/docs/tutorial_aspx/index.html?master_page_aspx.htm).

There are several properties that get written to the page using this method that I cannot find a way to modify through the CMS interface:

- DocType
- XmlNameSpace
- BodyClass
- BodyParameters
- HeaderTags

How are these controlled when using the ASPX template engine?

User avatar
Certified Developer 8
Certified Developer 8
dvanbale - 3/14/2011 10:57:17 AM
   
RE:Modifying DocType, XmlNamespace, HeaderTags, etc. in the ASPX Template
Dear Raleigh,

These properties can be specified in the TemplatePage which implements the Master Page you just created.

You can access the properties from code like this:

this.BodyClass = "bodyElement";

Regards,
dvanbale

User avatar
Certified Developer v6
Certified Developer v6
Nortech - 10/25/2011 2:30:34 AM
   
RE:Modifying DocType, XmlNamespace, HeaderTags, etc. in the ASPX Template
Using the ASPX engine you can modify for instance the body class of the master page from an aspx template page in the following way:
	protected override void OnInit(EventArgs e)
{
BodyClass = "home " + BodyClass;

base.OnInit(e);
}

Above I've added home class to the body tag. The space after the class name is used to separate it from the other BodyClass class names.

This works fine but I'd like a confirmation from Kentico though that this is a good way to change the body class of the master page from an aspx page.

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 10/25/2011 6:41:52 AM
   
RE:Modifying DocType, XmlNamespace, HeaderTags, etc. in the ASPX Template
Hi,

your solution seems to be correct. I am not aware any side issue.

Best regards,
Ivana Tomanickova