force line break inside .InnerText

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
 
C

Craig Deelsnyder

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>
 
C

Craig Deelsnyder

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>
 
J

John A Grandy

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.
 

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

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,997
Latest member
mileyka

Latest Threads

Top