HTML file from database to user interface

G

Guest

HTML file from database to user interface
I have a html document in a sql server table with tags and elements. I need
to read it from table field and show it in a web page. Is there any
component that I can use to show this html file in the browsed with
interpreting the html tags.
 
B

bill

Couldn't you just select the rows from the data and write out each raw line
with response.write(<data>)?
 
G

Guest

This page has other components and I need to show this html in the middle
section, I probably need a component that does that.
 
P

Patrice

You could put this in a literal control making this html fragment appears at
the exact location you want...
 
B

bill

An example of which part? You just select the data from the database, loop
through the result set, and for each loop you simply put
"response.write(<yourdata>)"...
 
N

Norm

Here is some sample/psuedo code. This should give you a good idea of
how to implement this.

<%@ Control ClassName="DataBaseHtmlLiteral" %>

<script runat="server">
Public DataBaseID as integer

Sub OnPreRender
' create sql connection and command
SqlCmd = "Select TOP 1
.
HTML:
 from [Table] WHERE [Table].
[IDField] = @ID"
    SqlCmd.Parameters.add("@ID",DatabaseID)

    HTML.Text = DirectCast(SqlCmd.ExecuteScalar(),String)
    ' clean up (close connection etc.)
  End Sub
</script>

<asp:Literal ID="HTML" runat="server" />


Each instance requires the DataBaseID to be set.
This assumes a single instance of the html, if you are looping through
the table, do not use this. Don't want
Also, error catching is needed (row doesn't exist, column is null,
DataBaseID is null, etc)

Hope this helps!
 

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

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top