how to render HTML entities to normal character into ASP literal control?
how there, I've these codes in my DATABASE in other words it's HTML. I tried these stuff:
<div runat="server" id="div1" visible="false">
<asp:Literal ID="literal1" runat="server" Text="" />
</div>
I tried in C# code behind:
div1.InnerText = contents;
div1.InnerHtml = contents
literal1.Text = contents;
But is still doesn't render well. I displays the original values in stead of a table and cells and columns. colours etc. etc....
What am I missing?
All these HTML's are in DABASE.Column e.g. column "Contents" e.g.
"& lt;p class=& quot;MsoNormal" style= "color: #339966;"><"
;" ;> ;< ;strong > 开发者_如何学JAVA;&l
ot; > ;& ;nbsp; < ;/span >< ;/p >
Can someone please advice? what I'm I misssing?
I've put (spaces between & and gt above code otherwise it was not showing in stackoverflow.) The HTML sysntaxs are correct because it's created by an HTMLEDITOR.
use
literal1.Text = this.HtmlDecode(contents);
Try response.Write(Contents)
And take a look at HtmlDecode
Are you saying that ;> ;<
etc is displaying on the browser, or only when you view the source?
精彩评论