This is a real long-shot, but here goes.

I followed this tutorial: httpcode.msdn.microsoft.comAdding-default-web-parts-ab7aec72#content

And successfully, have incorporated the server control into my page layouts mentioned in order to define a 'default' web part for the web part zone defined on my page layout.

The one problem I'm having is that when a user chooses to add a 'New Page' and then chooses the page layout in question - the web part zones are not actually in edit mode (despite the fact that the query strings do define ControlMode as Edit and DisplayMode as Design).

The one way I've found around this is to append &ToolPaneView=3 onto the query string - but as you may know - this then displays the 'Add Web Parts' dialog - and this isn't something that fits the spec.

If anyone knows of any other ways I can taket he user to a display mode were the web part zones are automatically editable I'd really really appreciate it.

EDIT: I've also tried the Contents=1 parameter, with no luck.

1 Answer 1


This is the code i've used before to make a page layout editable only when being displayed in a modal. You should be able to get what you need from it:

        function ChangeToEditMode(){
            if (window.location.search.match("[?&]PageView=Shared")){
                var inDesignMode = document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value; 

                if (inDesignMode == "1") 
                    // page is in edit mode 
                    SP.UI.ModalDialog.commonModalDialogClose(1, null); 
                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";

        if (window.location.search.match("[?&]IsDlg=1")) {
            ExecuteOrDelayUntilScriptLoaded(ChangeToEditMode, "sp.js");

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.