Text doesn't display correctly when loaded from SQL DB

179 Views Asked by At

I use FreeTextBox for my webpage. And when I load the text again from Database to display on a Label, it doesn't display correctly( still contain HTML tag: ,...) Take a look at my code below ( load the text from the DB)

Datatable db= excute .....;
string content = db.Rows[0]["CONTENT"].toString();

Label1.Text= content;

Just a basic codes , I really don't know where is the mistake.

Label1.Text ----> Demo freetextbox<div> just a simple demo</div><div>dnalksdfasdflklsd</div>
1

There are 1 best solutions below

0
vyclarks On BEST ANSWER
Label1.Text = HttpUtilities.HtmlDecode(content);

It decode the text, and the text will be displayed correctly.