How to display HTML code without rendering or converting?
Hi All,
I had saved a html code to database, and I want to display this code at UL without rendering, meaning needs to show all the HTML tags.
sample:
Hello in DB, and I want to see Hello at UL instead of bolded "Hello"
How can I attrive it? Literal & Label will auto render this HTML code to be bolded "Hello".
Thank you in advance for your time.
Kirtan PatelPosted Oct 7, 2009, 12:13 PM
Here is Code for Displaying HTML in aspx page
dont forget to mark "Do you like this answer" please it will give me some credits :)
protected void Page_Load(object sender, EventArgs e)
{
//Your HTML Content
string HTML = "Hello World";
//Encode it to Convert it in < > etc
string Encoded = Context.Server.HtmlEncode(HTML);
//Show HTML Code in Aspx
Label1.Text = Encoded;
}
Ellen HuPosted Oct 7, 2009, 6:45 PM
Roei BarPosted Oct 7, 2009, 12:07 PM
Master BillaPosted Oct 7, 2009, 12:04 PM
its very easy
Add content place holder in your form, then read the string from the database and assign to content place holder
private void SetToGUI()
{
contntplachldr.controls.add(your html text);
}
thank you