Design and CSS styles
Version 3.x > Design and CSS styles > Need to Get MasterPage set for a site in ASP.Net code View modes: 
User avatar
Member
Member
amit.deserwani-gmail - 2/9/2009 5:18:10 AM
   
Need to Get MasterPage set for a site in ASP.Net code
Hi,

I am currently working on the trail version for Kentico CMS. I have an existing ASP.Net website. I have created an Site on Kenticoportal. I need to the name of master page set on portal in my ASP.Net code. Could you please suggest me any function in your api to do the same?.

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 2/9/2009 7:29:22 AM
   
RE:Need to Get MasterPage set for a site in ASP.Net code
Hi,

You could select the root document – its Alias path is ‘/‘. Please see here:
http://devnet.kentico.com/docs/devguide/selecting_nodes.htm

Then you could know the page template ID:

node. DocumentPageTemplateID

then you could use:

CMS.PortalEngine.PageTemplateInfoProvider.GetPageTemplateInfo(pageTemplateId)
to get the object of PageTemplateInfo class.

CMS.PortalEngine.PageTemplateInfo.CodeName (resp. DisplayName)
returns the name of template.

Best regards,
Helena Grulichova