1

I have made a Content Type:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <!-- Parent ContentType: Page (0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39) -->
  <ContentType ID="0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900888dea275b1a4513a29b0415dd95bfe2"
               Name="LandingPageV4"
               Group="Custom Content Types"
               Description=""
               Inherits="TRUE"
               Version="0">
    <FieldRefs>
      <FieldRef ID="{6EC1D5A7-18B3-4F06-A2D0-BF1E84FE7045}" Name="Content1" />
    </FieldRefs>
  </ContentType>

  <Field ID="{6EC1D5A7-18B3-4F06-A2D0-BF1E84FE7045}" Name="Content1" StaticName="Content1" DisplayName="Content1" Type="HTML" RichText="TRUE" RichTextMode="FullHtml" />
</Elements>

and placed a RichHtmlField control within my Page Layout:

<PublishingWebControls:RichHtmlField FieldName="6ec1d5a7-18b3-4f06-a2d0-bf1e84fe7045" runat="server" id="RichHtmlField1">
</PublishingWebControls:RichHtmlField>

But when I go to page properties and write something like <div>a<b>s</b>d</div>, it's not rendered as HTML when I'm on the page but it only writes the code inline on the page. Also when I go to Edit Page and try to insert a picture within this field it looks OK, but when I save the page it only displays inline HTML code like: <img alt="content1.png" src="/AnalyticsReports/content1.png" style="margin: 5px"/><span id="ms-rterangecursor-start"></span><span id="ms-rterangecursor-end"></span>

Help me, please. I've tried following this page http://www.rkinteractive.com/blogs/SoftwareDevelopment/post/2012/01/06/Creating-Custom-Content-Types-and-Page-Layouts-in-Visual-Studio-2010.aspx but it doesn't change a thing. What can be the reason for this issue?

2 Answers 2

1

It turned out to be a Content Type caching issue... Apparently SharePoint remembered the version of it when it was not fully developed.

Creating a new Site Collection resolved the issue.

0

Try this:

<PublishingWebControls:RichHtmlField FieldName="Content1" runat="server" id="RichHtmlField1"> </PublishingWebControls:RichHtmlField>

I have replaced the name of the field as the value for the FieldName attribute

Hope this helps!!

2
  • Exception: Type 'Microsoft.SharePoint.Publishing.WebControls.RichHtmlField' does not have a public property named 'RichText'. Commented Oct 29, 2014 at 13:32
  • PublishingWebControls seems to be not set to the right namespace, that causes this error.
    – Sascha
    Commented Jul 28, 2016 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.