Thursday, March 31, 2011

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?

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

  • 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.

  • 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?

0 comments:

Post a Comment