473,320 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Displaying html stored in DB

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
--
----------------------------------------
Magic is not in the hands of the magician but in the mind of the audience.

Animadverto est verus
Aug 18 '06 #1
5 1525
How about adding the markup into a LiteralControl, which you can then hang on
a Placeholder control on the page?

http://msdn.microsoft.com/library/de...classtopic.asp

Peter

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


"Rik Brooks" wrote:
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
--
----------------------------------------
Magic is not in the hands of the magician but in the mind of the audience.

Animadverto est verus

Aug 18 '06 #2
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


"Peter Bromberg [C# MVP]" wrote:
How about adding the markup into a LiteralControl, which you can then hang on
a Placeholder control on the page?

http://msdn.microsoft.com/library/de...classtopic.asp

Peter

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


"Rik Brooks" wrote:
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
--
----------------------------------------
Magic is not in the hands of the magician but in the mind of the audience.

Animadverto est verus
Aug 18 '06 #3
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


"Rik Brooks" wrote:
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


"Peter Bromberg [C# MVP]" wrote:
How about adding the markup into a LiteralControl, which you can then hang on
a Placeholder control on the page?

http://msdn.microsoft.com/library/de...classtopic.asp

Peter

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


"Rik Brooks" wrote:
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
--
----------------------------------------
Magic is not in the hands of the magician but in the mind of the audience.
>
Animadverto est verus
>
>
Aug 18 '06 #4
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


"Peter Bromberg [C# MVP]" wrote:
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


"Rik Brooks" wrote:
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


"Peter Bromberg [C# MVP]" wrote:
How about adding the markup into a LiteralControl, which you can then hang on
a Placeholder control on the page?
>
http://msdn.microsoft.com/library/de...classtopic.asp
>
Peter
>
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
>
>
>
>
"Rik Brooks" wrote:
>
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
--
----------------------------------------
Magic is not in the hands of the magician but in the mind of the audience.

Animadverto est verus
Aug 18 '06 #5
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 </strongof 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


"Peter Bromberg [C# MVP]" wrote:
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


"Rik Brooks" wrote:
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


"Peter Bromberg [C# MVP]" wrote:
How about adding the markup into a LiteralControl, which you can then hang on
a Placeholder control on the page?
>
http://msdn.microsoft.com/library/de...classtopic.asp
>
Peter
>
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
>
>
>
>
"Rik Brooks" wrote:
>
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
--
----------------------------------------
Magic is not in the hands of the magician but in the mind of the audience.

Animadverto est verus
Aug 18 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Fuzzyman | last post by:
Does anyone know of an 'easy' way of displaying HTML from python - preferably using standard Tkinter widgets. I've heard that the 'Text' widget can be used to do this - but I don't fancy hand...
1
by: Dave Posh | last post by:
I seem to be having a problem displaying time stored in mysql. The format stored in the database is 13:15:05. The database data type is time. I'm using asp vbscript and sql to retrieve the time...
2
by: Steve Barnett | last post by:
I have a desktop application that needs to display some summary information. At present I use the RichTextBox control but am unhappy with the results. What I would prefer to do is display an HTML...
0
by: GM | last post by:
Is it possible to store html stored in a database field and have it maintain the formating? Can you set it to edit the data in a textarea? thanks,
5
by: Tomaz Koritnik | last post by:
Hi I have many short HTML files stored in a binary stream storage to display descriptions for various items in application. HTML would be display inside application using some .NET control or...
0
by: Anthony Harkness-Gripe | last post by:
This is a very simple XSLT, and I'm doing it ways that I've had work before, but it's not displaying HTML. Is there a flaw in my logic? C#:...
0
by: psid | last post by:
Displaying HTML/XHTML from source XML file i am having an xml file i want to display the contents of the xml file in a web browser control in winforms however i want to display it as...
2
by: Arinté | last post by:
I have a webpage that I want to have a list of dates and on the right I want to show the blog info associated with that date. That blog could have some html info in it, what would be the best...
7
by: GaryDean | last post by:
I have HTML formatted documents stored in a database. I want to display them on a web page. However I see there is no "browser control" in asp (as there is in windows forms). This sounds kind of...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.