Please check: if (Sitecore.Context.PageMode.IsPageEditorEditing)
also working on Sitecore 6.6, it does not depend on Sitecore 7.
Please also mark this entry on Sitecore on the blog by Martina Velander.
To check if the normal use of the page is: if (Sitecore.Context.PageMode.IsNormal)
To check if the preview mode is used: if (Sitecore.Context.PageMode.IsPreview)
There are also other PageMode:
- IsPageEditorClassic
- IsPageEditorDesigning
- IsPageEditorEditing
- IsPageEditorNavigating etc.
If you're interested, you can check this class with the Reflector or dotPeek: Sitecore.Context.PageMode from the Sitecore.Kernel assembly.
user459491
source share