I'm using SiteCore 7 MVC and Glassmapper.
I have a set of samples which are rendered using razor and set as standard values when an Author/Editor creates a new page. I wish to prevent the editor from modifying these samples in the PageEditor.
I have used
Model.FullPath.Contains("sample")
to check if the item being rendered is an item from the sample folder.
This technique works with images using:
@RenderImage(x => x.Image, isEditable:!Model.FullPath.Contains("sample"))
However when I render rich edited text fields (generated by TinyMce) in the following manner:
@(Model.FullPath.Contains("sample") ?
Html.Raw(Model.RichTextLeft) :
Editable(x => x.RichTextLeft))
The field remains editable even when rendered separately. I have tried using
@Html.Sitecore().Field("SectionTitle")
to render the field (which actually renders nothing).
and
@Html.Raw(Model.RichTextLeft)
to no avail
Any advice would be appreciated.
code @(Model.FullPath.ToLower().Contains("samples") ? Html.Raw(Sitecore.Context.Database.GetItem(new Sitecore.Data.ID(Model.Id))["RichTextLeft"]): Editable(x => x.RichTextLeft))
as a method of pulling the value with no mark up added by the mapper. – Ovee