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

Forums / Designing with Sitefinity / how to hide Template from Template list in edit mode ?

how to hide Template from Template list in edit mode ?

3 posts, 0 answered
  1. sameer
    sameer avatar
    14 posts
    Registered:
    28 Apr 2009
    25 Jun 2009
    Link to this post
    hi
    i upload masterpage as template and i use it to one page
    now in edit mode i want to hide this template from Template list (dropdownlist)
    can i do this ?
  2. sameer
    sameer avatar
    14 posts
    Registered:
    28 Apr 2009
    25 Jun 2009
    Link to this post
    hi
    sorry i forget another point
    i want to ask also can i hide one theme from themes list in edit mode ?
  3. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    25 Jun 2009
    Link to this post
    Hi sameer,

    Here are the steps that you should follow.

    1. Create a new class in App_Code

    using System.Web.UI; 
    using Telerik.Cms.Web; 
    using Telerik.Cms.Web.UI; 
    using System.Web.UI.WebControls; 
    using Telerik.Security; 
     
     
    /// <summary> 
    /// inherit EditPage class 
    /// </summary> 
    public class HackEditPage : EditPage 
        public HackEditPage() 
        { 
        } 
     
        // override CreateChildControls method. 
        protected override void CreateChildControls() 
        { 
            base.CreateChildControls(); 
     
            //Find the toolbar control 
            ToolBar toolbar = this.Form.FindControl("toolbar"as ToolBar; 
            // find the container where themes DropDownList control is located 
            // here you can use recursion as well. 
            Control cntr = toolbar.Controls[0].Controls[0]; 
            cntr = cntr.Controls[cntr.Controls.Count - 1]; 
            cntr = cntr.Controls[cntr.Controls.Count - 1]; 
            cntr = cntr.Controls[cntr.Controls.Count - 1]; 
            // check whether there is container and toolbar control. 
            if (cntr != null && toolbar != null && UserManager.IsCurrentUserInRole("QA")) 
            { 
                // find the DropDownList control 
                 DropDownList ddList = cntr.FindControl("themes"as DropDownList; 
                   // loop through the list items 
                    foreach (ListItem item in ddList.Items) 
                    {     
                        // get the item Text 
                        if (item.Text.Equals("Company")) 
                        { 
                            // diable the item 
                            item.Enabled = false
                        } 
                    } 
             } 
         } 
     

    Then you need to modify EditPage.aspx ~/Sitefinity/Admin/EditPage.aspx and inherit from our custom control

    <%@ Page Inherits="HackEditPage, App_Code" MasterPageFile="~/Sitefinity/Dummy.master" %> 


    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
3 posts, 0 answered