I have a need to throw down a link in the right side bar of my page that will allow the user to put the page into edit mode. The edit page link in the site actions menu seems to do a postback to get the page into edit mode. My question is how can I put the current page into mode, or obtain a link that will have the same effect?

2 Answers 2


I don't think you can put the page in edit mode by just clicking a link and without causing a server trip because the page needs to be checked out before it can be put in edit mode.

If you append following to current page url, page can be put in edit mode with a server trip and it might give a message if page is not checked out:


UPDATE Based on Comments

How about using out of the box control which displays Edit button link when page is in display mode and save button when the page is in edit button. Using this you dont have to worry about checking states, permissions, display/hide etc.

<SharePoint:PageStateActionButton ID="PageStateActionButton" runat="server" Visible="false" />
  • I have no problem with doing a postback and redirect, I'm just looking for the code to take those actions.
    – James
    Commented Jan 12, 2012 at 19:20
  • Thanks for that but I think that is a 2010 only construct, this solution has to work with 2007.
    – James
    Commented Jan 12, 2012 at 20:52

Problem solved. Here was the solution I ended up using.

<a id="editPageLink" runat="server" href="javascript:switchToAuthoringMode();" class="edititem"><label></label>edit this page</a>

<script type="text/javascript">
    function switchToAuthoringMode() {

        if (document.forms['aspnetForm']['MSOLayout_InDesignMode'] != null)
            document.forms['aspnetForm']['MSOLayout_InDesignMode'].value = 1;
        if (document.forms['aspnetForm']['MSOAuthoringConsole_FormContext'] != null)
            document.forms['aspnetForm']['MSOAuthoringConsole_FormContext'].value = 1;
        if (document.forms['aspnetForm']['MSOSPWebPartManager_DisplayModeName'] != null)
            document.forms['aspnetForm']['MSOSPWebPartManager_DisplayModeName'].value = 'Design';

        <%= Page.ClientScript.GetPostBackEventReference(editPageLink, "EditCommunityPage", true) %>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.