0

I have created page content type in which there is one field of type Multiple lines of text where I am storing comments of Page.

I have created page layout and displaying the comments on page. But the line breaks are not render in the page layout in display mode.

The page layout contains following code.

<SharePointWebControls:FieldValue FieldName="Comments" DisableInputFieldLabel="true" runat="server"></SharePointWebControls:FieldValue>

Below is the image of the item's display form where it looks fine with line breaks.

enter image description here

Below is the image of the page layout where the multi line text box field displays value in the straight line.

enter image description here

What am I missing?

2

I am posting this answer really late but it wasted hours of mine to find the correct approach while it was really a very small thing to be changed. So, to save other's time :

<SharePointWebControls:RichTextField FieldName="Comments" DisableInputFieldLabel="true" runat="server"></SharePointWebControls:RichTextField>

Instead of

<SharePointWebControls:FieldValue FieldName="Comments" DisableInputFieldLabel="true" runat="server"></SharePointWebControls:FieldValue>

will work.

| improve this answer | |
0

The reason this is happening is because in your page layout you are specifying a text field (SharePointWebControls:FieldValue) where you really want to display using a HTML field. try using the following instead.

    <PageFieldNoteField:NoteField FieldName="68f3c200-fee2-413d-9be2-2b23817ad133" runat="server">

Note field seems strange but its the right one to use as long as your comments field is set to be HTML.

| improve this answer | |
  • Did this work? Worthwhile feeding this back... – Stephen Jan 21 '15 at 16:44
0

Actually problem is that, Multiline puts uses Environment.NewLine and which in returns gives \n, this is not rendered correctly in html, and thus result in straight text in display mode.

You will need to replace this new line with "<br/>", then it should work fine.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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