Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm wondering if there are any differences between retrieving value of a site column (RichHtmlField) via PublishingWebControls:RichHtmlField vs getting its value via Container.DataItem?

<ItemTemplate>
    <div runat="server">
    <%# ((SPListItem)Container.DataItem)["SP_COLUMN_NAME"]%>
    </div>     
</ItemTemplate>

vs

<PublishingWebControls:RichHtmlField ID="..." FieldName="SP_COLUMN_NAME" ... ></PublishingWebControls:RichHtmlField>

I'm wondering about this because I'm retrieving value of a specific site column of type RichHtmlField in visual web part using CAML query and binding value of that column to ListView. It's working properly, but I found that if I added CEWP inside RichHtmlField, the content of CEWP is not rendered (I found later that content of CEWP is rendered before the end of page wrapped in hidden div). I'm using CEWP for embedding youtube video in page following this solution. But while viewing the column value via PublishingWebControls:RichHtmlField control it's working properly without any issues.

Any suggestions?

share|improve this question
    
Did you try <SharePointWebControls:FieldValue FieldName="SP_COLUMN_NAME" runat="server" /> –  Oddmar Dam Oct 22 '12 at 12:27

1 Answer 1

The "PublishingWebControls:RichHtmlField" control is capable of rendering field data, not web parts -- I think this is where the confusion is coming from. In my experience, the data coming from code-behind vs. declarative have been the same.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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