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

Forums / Suggestions / What template is being used...

What template is being used...

2 posts, 0 answered
  1. James@Nw
    James@Nw avatar
    265 posts
    Registered:
    05 May 2009
    11 Jan 2010
    Link to this post
    Hi Guys,

    If I work with multiple templates I often have to go back and check what template I used on a page to make the changes to it. I then have to go into edit mode of that page before it tells me what template I have used.

    Please take a look at the screenshot I have posted, this would be a nice feature to have to see what template a certain page is using without having to go into it.

    Thanks!
    James
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    11 Jan 2010
    Link to this post
    Hello James,

    Thank you for your suggestion. You can easily achieve this functionality by getting the selected page and setting the Text of an Label control to the IPageTemplate name. Below is a sample code:

    PageViewer.ascx.cs ( here you have to create a code behind of PageViewer.ascx)

    protected override void OnPreRender(EventArgs e)
    {
        Guid pageID = ((Telerik.Cms.Web.UI.PageEditor)(this.Parent.Parent.Parent.Parent.Parent.Parent)).SelectedPageId;
        var manager = new Telerik.Cms.CmsManager();
        Telerik.Cms.IPage page = manager.GetPage(pageID);
        IPageTemplate pt = page.Staged.Template;
        string name = pt.Name;
        Response.Write(name);
    }


    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered