In vb.net I have a DataTable that I am adding content to. One column contains a free text field so I want to show the new lines as new lines on the page. I did this:
For Each row As DataRow In dtEmails.Rows
Dim newBody As String = row.Item("body").ToString.Replace(vbCrLf, "<br>")
row.Item("body") = newBody
Next
But the cells now just show literal HTML like Line<br>Line. One forum thread I found suggested calling Server.HtmlDecode on the string but that doesn’t work. Is there another way?
I found an answer to this – calling
Server.HtmlDecodeas each row is bound.