1
votes

I have a rich text field. I wanted to know if there is way to prevent this rich text field from editable using experience editor in Sitecore.

Say suppose I have multiple rich text fields,

  1. Banner content
  2. Abstract content
  3. Body content

Out of these how to I prevent only Banner content from editing, remaining 2 fields can be edited from page editor

1

1 Answers

7
votes

Yes, there are multiple options.

You haven't shared your code, so I'll paste only few of them:

  1. When using a Sitecore control:
 <sc:Text Field="Banner content" DisableWebEditing="true" runat="server" />
  1. When using the Sitecore MVC helper:
@Html.Sitecore().Field("Banner content", new { disable-web-editing=true })

Update for Sitecore 8: { DisableWebEdit = true }

  1. When using the FieldRenderer.Render() method directly:
FieldRenderer.Render("Banner content", "disable-web-editing=true")

More in Chapter 2 of Sitecore CMS 7 and later Page Editor Recommended Practices for Developers