Monday, March 26, 2012

HTML file from database to user interface

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.Couldn't you just select the rows from the data and write out each raw line
with response.write(<data> )?
"JIM.H." <JIMH@.discussions.microsoft.com> wrote in message
news:10BCEEB4-E71E-43B2-849B-19E71953C348@.microsoft.com...
> 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.
>
This page has other components and I need to show this html in the middle
section, I probably need a component that does that.
"bill" wrote:

> Couldn't you just select the rows from the data and write out each raw lin
e
> with response.write(<data> )?
> "JIM.H." <JIMH@.discussions.microsoft.com> wrote in message
> news:10BCEEB4-E71E-43B2-849B-19E71953C348@.microsoft.com...
>
>
You could put this in a literal control making this html fragment appears at
the exact location you want...
Patrice
"JIM.H." <JIMH@.discussions.microsoft.com> a crit dans le message de news:
AF276C5B-8F44-4D1E-B124-33AA23223736@.microsoft.com...
> This page has other components and I need to show this html in the middle
> section, I probably need a component that does that.
> "bill" wrote:
>
I am quite new, can you give me an example pelase?
"Patrice" wrote:

> You could put this in a literal control making this html fragment appears
at
> the exact location you want...
> --
> Patrice
> "JIM.H." <JIMH@.discussions.microsoft.com> a écrit dans le message de news
:
> AF276C5B-8F44-4D1E-B124-33AA23223736@.microsoft.com...
>
>
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> )"...
"JIM.H." <JIMH@.discussions.microsoft.com> wrote in message
news:56642F77-1368-4BFE-82E9-17E35DAD1473@.microsoft.com...
>I am quite new, can you give me an example pelase?
> "Patrice" wrote:
>
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 [Table].[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!
I guess you meant Literal?
JIM. H. wrote:
> HTML file from database to user interface
> I have a html document in a sql server table with tags and elements. I ne
ed
> 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.

No comments:

Post a Comment