I'm working on a SharePoint 2010 solution and I am trying to add a calculated column to an existing list. The column should display rendered html, but displays html encoded html. This problem occur only when adding columns to the existing list. When creating a new list and adding the same calculated column, the html is displayed correctly.

The only visible clue I get is the existing list has blue column headers, while the new list has black column headers. Looks like different aspx/ascx files are handling the output. How do I solve this problem? Can I locate the page responsible for rendering the list?

Thank you for any help!

Regards, Rune

  • Those are called Views associated with the list. You can open the Site in SharePoint Desginer. Then open the list, there you can find the associated views (.aspx) pages. Jan 27, 2015 at 13:54
  • Using SharePoint designer I see that the old list is using ListViewWebPart, while the new list are using XsltListViewWebPart. The old list is probably migrated from SP2007.
    – Rune
    Jan 27, 2015 at 14:58
  • You can covert it to an XsltListViewWebPart. Make sure you are working on a copy. Jan 27, 2015 at 14:59
  • yes, I am searching the net for a solution now. Do you know of any resource(url) that has a working solution?
    – Rune
    Jan 27, 2015 at 15:09
  • Amal, do you know how to convert it to an XsltListViewWebPart (programmatically)?
    – Rune
    Jan 28, 2015 at 14:37

2 Answers 2


There is a hack that solves that problem (that is by design on the other hand, and is there since SP 2010) without SharePoint Designer. Define your calculated field as date or number instead of text, and it won't be HTML escaped any more. See 4. The HTML Trick in this post for example. Of course you can use SPD if you wish, but I definitely would not customize the views for this reason.

  • The calculated field is defined as number. The HTML is encoded in the modififed list and not encoded in the new list.
    – Rune
    Jan 27, 2015 at 14:09
  • What do you mean on "existing" and "new" list? As you add the calculated field to the list, all list should be already "existing". I assume the "existing" list might have been created by someone else, and have been probably customized. Create a new View for existing list, and see how the calculated field is rendered in that view.
    – pholpar
    Jan 27, 2015 at 14:18
  • Yes. The existing list is created by someone else. I've created a new list to help me debugging the problem. I've created a new view for the old list, but the output is still htmlencoded.
    – Rune
    Jan 27, 2015 at 14:35
  • In SP2010 Columns do not behave different in another View in the same list. The problem is in the original existing list. Try switching the setting on the original list, from Number to String, save it.. it will display the HTML as text, switch it to Number again... if it still displays HTML as text, go find the person who created that list and ask how they created it. HTML (and JavaScript) in Calculated Columns can be a lot of fun.. see ViewMaster365.com Jan 27, 2015 at 14:43
  • "In SP2010 Columns do not behave different in another View in the same list." that may depend on what kind of customizations one already has done on the other view, I mean the rendering XSL, just to name a simple example, rendering a field in a view may contain the disable-output-escaping, in the other view may not. We have the same field in both views but it behaves differently, and there may be more advanced customizations as well. Switching data type of the calculated field to 'Single line of text' and then back to 'Number' is a good idea.
    – pholpar
    Jan 28, 2015 at 7:18

If you are unable to get the HTML to render when the calculated column's data type is set to Number, you can try a different approach.

Add a rich text field to the list and copy the value from the calculated column to the rich text field via a SharePoint Designer workflow that triggers when items are added or updated.

You can hide the rich text field from forms by enabling editing of content types on your list, then setting the rich text field to "hidden" for each content type.

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.