Last post Mar 21, 2017 07:44 AM by PatriceSc
Mar 20, 2017 07:29 PM|comego|LINK
What I want to save into the database table is some very basic HTML tags, like <br /> and <a href="">link</a>. I want these tags to display on webpages just as they are meant to, like <br /> for another line, and <a> for a hyperlink. How can I achieve
that? Right now, they display on the webpages literally as text.
Mar 20, 2017 10:05 PM|vinz|LINK
Encode your data from database when displaying. For example:
HttpUtility.HtmlEncode("You HTML data here")
Mar 20, 2017 10:06 PM|comego|LINK
It's that easy? Let me try. Thanks!
Mar 21, 2017 07:44 AM|PatriceSc|LINK
Or it is maybe the other way round ie the control you are using already "HtmlEncode" your markup causing it to be shown as text.
Which control do you use? Sometimes you have an HtmlEncode property that allows to control this behavior. Else you'll perhaps have to use another control such as the Literal control: