Search code examples
episerver

Is it possible to trigger the "Quick-edit" function using an <a> tag from within a page outside of EPiServer edit mode?


  1. Navigate to a page
  2. Click the Quick-edit button (a regular a-tag) enter image description here
  3. The users goes into Quick-edit mode enter image description here

Is this possible and how to achieve?

Note: The question is targeted at EPiServer 6 R2 in this particular case.


Solution

  • Johan is absolutely right. His answer works beautifully.

    I wanted to share my final result:

    1. Create a personal blog publically. By publically I mean you're really just using EPiServers edit-mode stuff.

      uxCreatePersonalBlog.NavigateUrl = String.Format("{0}EditPanel.aspx?parent={1}&type=82&epslanguage={2}&mode=simpleeditmode",
          UriSupport.AbsoluteUrlFromUIBySettings("edit/"),
          CurrentPage.PageLink,
          CurrentPage.LanguageBranch);
      
      uxCreatePersonalBlog.Visible = CurrentPage.QueryDistinctAccess(AccessLevel.Create);
      
    2. Create a blog item publically.

      uxCreateBlogItem.NavigateUrl = String.Format("{0}EditPanel.aspx?parent={1}&type=80&epslanguage={2}&mode=simpleeditmode",
          UriSupport.AbsoluteUrlFromUIBySettings("edit/"),
          CurrentPage.PageLink,
          CurrentPage.LanguageBranch);
      
      uxCreateBlogItem.Visible = CurrentPage.QueryDistinctAccess(AccessLevel.Create);
      
    3. Edit a blog item publically.

      uxEditBlogItem.NavigateUrl = String.Format("{0}Default.aspx?id={1}&epslanguage={2}&mode=simpleeditmode",
          UriSupport.AbsoluteUrlFromUIBySettings("edit/"),
          CurrentPage.PageLink,
          CurrentPage.LanguageBranch);
      
      uxEditBlogItem.Visible = CurrentPage.QueryDistinctAccess(AccessLevel.Edit);
      

    Notice that I've used mode=simpleeditmode on all three buttons. If you don't use mode=simpleeditmode you will end up with the EPiServer edit-mode interface in the header after saving and publishing your page.

    epslanguage is not necessary if you only have your site in one language. I added it just in case sometime in the future we decide to make it multilingual.

    type is hard-coded. Is there a way to implement this in a more elegant way?