How can I insert HTML markup that is interperted as such?

  • Thread starter Thread starter _Who
  • Start date Start date
W

_Who

In the .aspx I have

<p runat="server" id="qq" > </p>

and in the aspx.vb I have

Protected Sub qq_Init(ByVal sender As Object, ByVal e As System.EventArgs)
Handles qq.Init

strContents = "<h1>QQQQQQ</h1>"

qq.InnerText = strContents

End Sub

But this produces as text

<h1>QQQQQQ</h1>

The tags are treated as text.

How can I insert HTML markup that is interpreted as such?



Thanks
 
_Who said:
In the .aspx I have

<p runat="server" id="qq" > </p>

and in the aspx.vb I have

Protected Sub qq_Init(ByVal sender As Object, ByVal e As System.EventArgs)
Handles qq.Init

strContents = "<h1>QQQQQQ</h1>"

qq.InnerText = strContents

End Sub

But this produces as text

<h1>QQQQQQ</h1>

The tags are treated as text.

How can I insert HTML markup that is interpreted as such?



Thanks



I belive there is InnerHtml which will not HtmlEncode the string you put
in..

George.
 
I almost have it working!
In the .aspx I have

<p runat="server" id="qq" > </p>

and in the aspx.vb I have

Protected Sub qq_Init(ByVal sender As Object, ByVal e As System.EventArgs)
Handles qq.Init

Dim csmKey As String = "CopyHtml"

Dim csmType As Type = Me.GetType()

Dim csm As ClientScriptManager = Page.ClientScript

If (Not csm.IsStartupScriptRegistered(csmType, csmKey)) Then

Dim csmScript As New StringBuilder() 'The startup script literal to register

csmScript.Append("document.write('<h1>ssssss</h1>")

csmScript.Append("<p>eeee</p>")

csmScript.Append("');")


csm.RegisterStartupScript(csmType, csmKey, csmScript.ToString, True)

End If
This does produce the formated tex on the page

But at the bottom of the page. Not where the qq is.

How can I control where it goes?
 
George said:
I belive there is InnerHtml which will not HtmlEncode the string you put


That makes sense. I'll look for it.
Please see my other reply to this topic.
Thanks
 
Back
Top