Sign up ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am taking a value from a string from a text column

String str = myListItem[field name].toString()

In many cases the field may contain html which I wish to remove but it is somehow not visibly contained in str. When str is output to the webpart it still has the html tags.

How can I return the field value with the html tags in the text?

share|improve this question
Sean, you mean the text contains HTML and you want to treat is as a string and show up on Label ? –  Arsalan Adam Khatri Nov 12 '12 at 7:46

1 Answer 1

use Server.HtmlDecode(string) Server.HtmlEncode(string) to encode and decode HTML.

share|improve this answer
Welcome to SharePoint.SE! While this post may answer the question, we prefer more details such as "why". Please edit your post with additional details. See How to Answer for general guidelines. –  Kit Menke Nov 13 '12 at 19:47

Your Answer


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.