Vulnerability in EPiServer.Forms
How is it possible to check if a block is open in the editor and I also want to check if the block is viewed in a content area on a page in the editor?
Im having an issue with my blocks where it is rendered fine when viewed only for the block in the editor, but when the page is viewed where the block is inserted I get some other data from the block that are specific for the block-editor and that I don't want to render when viewing the page in the editor.
I know how to check if a page is in editormode by using: EPiServer.Editor.PageEditing.PageIsInEditMode
But that dosen't seem to work for me.
You could add this to your action in your preview controller:
ViewBag.BlockPreview = true;
And then in your view, instead of using PageEditing.PageIsInEditMode, you use
@if(ViewBag.BlockPreview == true)
Sorry I forgot to say, My project is in webforms. Any tip for that? :)
Assuming you have a model called PreviewPage, you could try:
if (Page is PreviewPage)
Edit: Capital P
Works great! Thanks!
Thanks exactly what i needed
Thanks Per Magne
Your ViewBag.BlockPreview = true was a nice solution for my mvc project.
Your ViewBag.BlockPreview =
true was a nice solution for my mvc project.