Try our conversational search powered by Generative AI!

Check if user is in edit mode inside a custom property

Vote:
 

Hi,

Is it possible to check if a user is in edit mode inside a custom property? EPiServer.Editor.PageEditing.PageIsInEditMode is always false

 

/Tore

#69143
Mar 22, 2013 15:11
Vote:
 

That property should work. Is this a EPiServer 6 style custom property appearing in the new edit view?

#69145
Mar 22, 2013 15:53
Vote:
 

Hi Ben,

Yes, this is a EPiServer 6 style custom property. Is it possible to use any other property in EPiServer to determine if we are in edit mode or not?

#69146
Mar 22, 2013 16:03
Vote:
 

I've just investigated the legacy properties dialog and it seems there is a bug. The URL to load the custom property doesn't contain epieditmode=true in the query string.

This means that PageIsInEditMode will always return false since that property will only ever be true if the URL contains epieditmode=true in the query string.

I'll log a bug for this.

I'm not sure how you could work around this. My first suggestion would be to try convert the property to an EPiServer 7 style custom property.

#69148
Mar 22, 2013 16:20
Vote:
 

Do you mean inside a CMS 6 property control? I don't think we should or need to use the PageIsInEditMode property since legacy editor dialog is not actually new edit mode :).

By the way, checking the control's RenderType property can help in this case. 

#69152
Edited, Mar 22, 2013 16:50
Vote:
 

Inside a MVC view I use 

 

@if(PageEditing.PageIsInEditMode)
{

 

}

 

which is from EPiServer.Editor namespace

 

You also need to be on EPiServer 7 - patch 1

#69153
Edited, Mar 22, 2013 17:02
Vote:
 

Hi Ben,

thanks for finding that out! Could you also check why the PageLink is Null here?

@Duong Nguyen: I am inside the PropertyData class and not the PropertyDataControl.

@EPiDev: I am inside the PropertyData class, so this won`t help me much....

#69155
Mar 22, 2013 19:12
Vote:
 

Hi Ben,

Is this bug still there in EPiServer 7 Patch 4? Another thing, PageLink is also null here. Is this also a bug?

#79570
Dec 20, 2013 9:29
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.