Sara Chipps
Sara Chipps

Reputation: 9372

HTML text not formatting

so I have HTML formatted Sql text stored in my database, I populate the contents of a <p></p> tag with it on page load, but though HTML tags are showing up in the text they are not formatting the text. Is there a step I am missing?

Upvotes: 2

Views: 382

Answers (3)

Mark Brittingham
Mark Brittingham

Reputation: 28865

When you say that you are "populating the contents of a <p></p> tag" - what exactly do you mean? Typically, the choices that I see are A) using a Label and assigning the Text field or B) simply entering a string value directly where you want your HTML to appear.

<%#StringToWriteToHTMLStream%>

You'll need to call Databind() after setting the string contents from your database record.

Is this all you are after?

Upvotes: 0

baretta
baretta

Reputation: 7595

So how you outputting the HTML? You have a HtmlGenericControl running at server representing the <p> tag? Maybe you using InnerText instead of InnerHtml? Or, it could be a HTML encoding/decoding issue. Take a look at the HTML source.

Upvotes: 1

user65952
user65952

Reputation: 202

Use "html_entity_decode($str)" on the stored text when displaying.

Upvotes: 0

Related Questions