更新时间:2023-11-30 15:26:40
请检查:if (Sitecore.Context.PageMode.IsPageEditorEditing)
还在Sitecore 6.6上运行,它不依赖于Sitecore 7.
also is working on Sitecore 6.6, it not depends on Sitecore 7.
Please check also this Sitecore blog post by Martina Welander.
要检查页面是否正常,请使用:if (Sitecore.Context.PageMode.IsNormal)
To check if is normal page use: if (Sitecore.Context.PageMode.IsNormal)
要检查是否为预览模式,请使用:if (Sitecore.Context.PageMode.IsPreview)
To check if is preview mode use: if (Sitecore.Context.PageMode.IsPreview)
其他PageMode:
Also are others PageMode:
如果您好奇,可以使用Reflector或dotPeek进行此类检查: Sitecore.Kernel 程序集中的 Sitecore.Context.PageMode .
If you are curious you can check with Reflector or dotPeek this class: Sitecore.Context.PageMode from Sitecore.Kernel assembly.