force line break inside .InnerText

  • Thread starter Thread starter John A Grandy
  • Start date Start date
J

John A Grandy

when setting the InnerText property of a tag such as <span> , how to force a
line break?

Span1.InnerText = "some stuff" & vbCrLf & "some more stuff"

doesn't work ... the vbCrLf just shows up as a null-string
 
John said:
when setting the InnerText property of a tag such as <span> , how to force a
line break?

Span1.InnerText = "some stuff" & vbCrLf & "some more stuff"

doesn't work ... the vbCrLf just shows up as a null-string
I think you want to use the .InnerHtml property:

Span1.InnerHtml = "some stuff<br>some more stuff"

remember the crlf doesn't do anything in HTML (well, shouldn't, even
though sometimes IE adds a little space).....you need a <BR>
 
John said:
when setting the InnerText property of a tag such as <span> , how to force a
line break?

Span1.InnerText = "some stuff" & vbCrLf & "some more stuff"

doesn't work ... the vbCrLf just shows up as a null-string
I think you want to use the .InnerHtml property:

Span1.InnerHtml = "some stuff<br>some more stuff"

remember the crlf doesn't do anything in HTML (well, shouldn't, even
though sometimes IE adds a little space).....you need a <BR>
 
Hi Craig. Thanks for the response.

The reason I wasn't using .InnerHTML is that then I have to use
Server.HTMLEncode() on the text I want to display ...

.... and I've had strange results in the past using that function.

MySpan.InnerHTML = Server.HTMLEncode("some stuff<br>some other stuff")

works fine ... but more complex text can get funky results.
 
Back
Top