开发者

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&quot; style= &quot;color: #339966;&quot;&gt;&lt"

;&quot ;&gt ;&lt ;strong &gt 开发者_如何学JAVA;&l

ot; &gt ;&amp ;nbsp; &lt ;/span &gt;&lt ;/p &gt;

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 ;&gt ;&lt etc is displaying on the browser, or only when you view the source?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜