Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling html code from a db in aspx pages

Status
Not open for further replies.

ifntech

Programmer
Nov 4, 2004
80
US
I'm trying to call html code that is saved in a table to a content holder within an aspx page.

What would the syntax be for the query and connection and then the field call syntax within the contentholder.

I'm using the Visual Studio Web developer.

We have tried a few different ways, if we use the gridview it actually shows the html code in the final page instead of running it.

The page works fine if we manually put the html code within the content holder. But we want to store the html code in the db for maintenance.

We are very fimiliar to Asp and it works there, but can't seem to get it to work in aspx.

 
try this:

1. create a <div> tag with runat server attributes in the contnent holder. e.g.: <div id="myHtml" runat=server />
2. in CB:
myHtml.innerHTML="YOUR HTML"



Known is handfull, Unknown is worldfull
 
I'd probably suggest a Literal control. It's made specifically for holding actual HTML.
 
boulder:

i think anything will do as the div is declared as an HtmlGenericControl. which again is basically to output HTML...

Known is handfull, Unknown is worldfull
 
True, it will work in some cases, but you'll have a div on the page that you may not want. Literal outputs only the HTML you specify which gives it a slight advantage in this situation.
 
hmm,

let me check on that. i thought a literalcontrol outputs div tags too....

Known is handfull, Unknown is worldfull
 
i thought a literalcontrol outputs div tags too....
No, Literal controls will only output what you tell them to.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top