SharePoint – Quickly Create a custom Edit button

I had several issues with switching a page to edit mode from code (checking out the item, redirecting to the page with the right query string and the right form mode) for some reason, my publishing console was always behaving strangely (not possible to do a check-in, just publish for example).

After several hour of struggling, I found that way, without code behind, that works quite well although that’s really, really ugly. Let’s see if I can find something better but now, I can go home !

[a href=”javascript: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’;__doPostBack(‘ctl00$PlaceHolderTopNavBar$ SiteActionsMenuMain$ctl00$wsaEditPage_CmsActionControl’,’switchToAuthoring’)”]Edit the page[/a]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s