+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / TemplateID

TemplateID

2 posts, 0 answered
  1. Pik Lee
    Pik Lee avatar
    142 posts
    Registered:
    13 Aug 2012
    02 Dec 2010
    Link to this post
    Does anyone know how to get the current template ID from the C# code? I tried the following code, and it only allows me to get the default template id. It is not the template I've assigned to the page.

            CmsManager cms = new CmsManager();
            IPageTemplate template = cms.GetTemplate("Default");

    Thanks,
    ~Pik
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    02 Dec 2010
    Link to this post
    Hello Pik,

    1. You should get the page - you can use SiteMap.CurrentNode and its Key property. Then you have to call CmsManager and pass the ID to it.

    2. The ICmsPage has a  property Template that you can use.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered