database text with html formatting, how to pull it

2019-09-01 00:38发布

问题:

I have content that I want to load dynamically, the problem is it has some html formatting in it. What control should i pull the text into, is there a way to pull the text into a div or a label, along with the formatting?

回答1:

You can use an asp:Literal:

Code behind:

myLiteral.Text = HtmlDecode(GetTextFromDB())