Forums

Skip Navigation LinksHome / Developer Network / Forums / Sitefinity 3.x: Suggestions > What template is being used...

What template is being used...

  • James@Nw Master avatar

    Posted on Jan 11, 2010 (permalink)

    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
    Attached files

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Jan 11, 2010 (permalink)

    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.

    Reply

Skip Navigation LinksHome / Developer Network / Forums / Sitefinity 3.x: Suggestions > What template is being used...