We help IT Professionals succeed at work.

How to display HTML from a SQL table to a ASPX file?

mousemat24
mousemat24 used Ask the Experts™
on
Hi there

I have a SQL table, one of the columns is a text field, that text field has HTML. How do I get the HTML displayed to the user. I've used a textbox, but that acually display the HTML code.

Hope this makes sense?
Thank you
Mousemat24
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Hi

If you are writing an HTML editor the best way are to use <div> tags this can be set as server control <div id="divHTML" runat="server"></div>

here you'll be able to view the html and also edit it.

http://www.devarticles.com/c/a/HTML/Building-a-WYSIWYG-HTML-Editor-Part-1/

HTH

apb2
yeh create a div

<div id="YourHtmlDiv" runat="server"></div>

then in your code you have to Access the InnerHtml

so.... in C# this would be

YourHtmlDiv.InnerHtml = "<h1>Hello</h1>";

Author

Commented:
I've ended up using a literal control, is that ok?
as long as you set the InnerHtml of a control which has InnerHtml. Yes that is fine.
:-)

Andrew

Author

Commented:
dont understand Andrew, I'm finding a literal control takes care of that automatically. Strange, but it works ok
so have you got your solution now?

Author

Commented:
is, I'm using the literal control, thats before I got any response from you 2. I think I might have to split the points, hope thats ok with you guys?