0
votes

I have a Sitecore item ("Content Item"), which has a rich text as "<h2>Header text</h2>".

I want this to be rendered as html.

But using a field renderer when I try

FieldRenderer1.Item = DatabaseManager.MasterDatabase.GetItem(//content item);
FieldRenderer1.FieldName = "Content";"

Text is rendered as "<h2>Header text</h2>" in the mark up. How do I get them render as HTML?

1
Hello, normally it must work as expected. Can you check if you have checked Raw Valuee field on View Tab on Context Menu from Content Editor ? - user459491
It's turned off, Raw value is "<p>&lt;h2&gt;Be a Smart Seller&lt;/h2&gt;</p> <p> </p>" - Dhanuka777
Agree with sc climber on this. This is the normal way to use a field renderer. Ensure that you've added the HTML in the "HTML" view of the RichText editor and not the "Design" view. - Craig Taylor
<sc:FieldRenderer ID="FieldRenderer1" runat="server" /> - Dhanuka777
Yup, HTML is in the "HTML" view. Tried a Multiline text box, it worked. Still wondering why "Richtextbox" does not get rendered as html. - Dhanuka777

1 Answers

0
votes

After reading the comments, I think may be trying this might work.

<sc:FieldRenderer id="HeaderText" runat="server" FieldName="HeaderText" />

This fixed my issues when I was trying something similar at my end.

FieldName specification is a must when it comes to FieldRenderers.