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

Forums / Developing with Sitefinity / Creating a quick edit toolbar

Creating a quick edit toolbar

4 posts, 0 answered
  1. sam
    sam avatar
    102 posts
    Registered:
    31 Jan 2008
    27 Aug 2009
    Link to this post
    Hi Guys,

    Does anyone how to customise the toolbar you get when in page edit mode?
    And how to use it within non admin master pages?

    I am wanting to add a Go live button and some other quick link buttons.. and I am also wanting to reference
    the control within my other master page templates so when are user is authenticated and in a cms edit role
    they will see the toolbar at the top on all pages.

    This is much more user friendly and saves time on navigating..
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    27 Aug 2009
    Link to this post
    Hi sam,

    It will be more easy if you create a user/custom control which uses CmsManager api and exposes the same functionality( or different one) as Toolbar has - publish page, cancel, select theme and masterpage.

    You can easily get the id of the current page and pass it wherever you want. Then, for instance publish the page.

    var manager = new CmsManager(); 
    var currentNode = SiteMap.CurrentNode as CmsSiteMapNode; 
    var currentPage = currentNode.CmsPage as ICmsPage; 
    if (currentPage != null
        { 
            var page = manager.GetPage(currentPage.ID, trueas ICmsPage; 
        } 
     

    Another option is showing a quick link to the page edit mode when a user is authenticated.

             if (currentPage != null
                { 
                    var page = manager.GetPage(currentPage.ID, trueas ICmsPage; 
                    HyperLink link = new HyperLink(); 
                    link.Text = "EditThisPage"
                    link.NavigateUrl = page.StaticUrl.ToString() + "?cmspagemode=edit"
                    Controls.Add(link); 
                } 


    Regards,
    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.
  3. sam
    sam avatar
    102 posts
    Registered:
    31 Jan 2008
    27 Aug 2009
    Link to this post
    Hi Ivan,

    That stuff is easy enough. The problem is there is no button available in Edit mode to go back to the live site.

    If the user can toggle between live and edit mode this would be a good user experience..
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    27 Aug 2009
    Link to this post
    Hello sam,

    Below is a sample code that illustrates how to access the toolbar in PageEdit mode

    public class CustomEditPage : EditPage  
    {  
        public CustomEditPage()  
        {  
        }  
      
        // override CreateChildControls method.  
        protected override void CreateChildControls()  
        {  
            base.CreateChildControls();  
      
            //Find the toolbar control  
            ToolBar toolbar = this.Form.FindControl("toolbar"as ToolBar;  
              
            if (toolbar != null)  
            {  
               // add your logic here 
             }  
         }  
      
    }  

    Modify EditPage.aspx located under Sitefinity/Admin folder.

    <%@ Page Inherits="CustomEditPage, 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.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
4 posts, 0 answered