I want how to know if a page is in mode design with code-behind and/or xslt.

Does anyone knows how can I do that?


In Code-Behind you can use:

if( SPContext.Current.FormContext.FormMode == SPControlMode.Edit ){
    // Page in Edit Mode.

In JavaScript, you can use:

if( document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value ){
    console.log( 'Page in Edit Mode' ); 

You can also use the EditModePanel Control if you just want to use markup. Here's a reference: http://msdn.microsoft.com/en-us/library/office/jj822364(v=office.15).aspx

(These will only work on Publishing Pages)

  • know how to do with XSLT (DFWP) ?? – Andres Williams Sep 23 '14 at 2:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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