Displaying html stored in DB

G

Guest

I am writing a web application using C#. I've come to the point that I need
to display some html text that is stored in a database. Is there a server
side control that I can use to show the html? In other words, read the data,
then set the Text property (or something else) and it displays in the window
 
G

Guest

Oh Gawd I wish I understood what you just said.
--
----------------------------------------
Magic is not in the hands of the magician but in the mind of the audience.

Animadverto est verus
 
G

Guest

OK, look:

1) Drag a Placeholder Control onto your page where you want the HTML to
display.
2) Get the HTML Out of your database, let's say its in a string variable
"strContent".
3)

HtmlGenericControl ctl = new HtmlGenericControl(strContent);
Placeholder1.Controls.Add(ctl);

That's it. In VB.NET:

Dim ctl as New HtmlGenericControl(strContent)
Placeholder1.Controls.Add(ctl)


Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
 
G

Guest

Thank you so much for your patience, Peter. I copied and pasted exactly and
my page is just displaying nothing at all. Blank
--
----------------------------------------
Magic is not in the hands of the magician but in the mind of the audience.

Animadverto est verus
 
G

Guest

Ohhhh Peter, I'm so close. Now I get something. Here's my code:

// htmlData is read from db - for our test it is:
//this is <strong>a test </strong> of the html stuff
// I know this is true cuz I used the debugger and peeked at it.

HtmlGenericControl ctl = new HtmlGenericControl(htmlData);
PlaceHolderText.Controls.Add(ctl);

.... and Peter, here is what is shown on my screen:

a test of the html stuff>a test of the html stuff>


Even if you can't help me, thanks for what you've done so far, Peter.
--
----------------------------------------
Magic is not in the hands of the magician but in the mind of the audience.

Animadverto est verus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top