How to concatenate string with line breaks, all to be printed in a single label?

1.2k views Asked by At

I'm trying to concatenate a string so that when I send it to my web form, it will become the text in a single label.

For some reason, all of the different types of line breaks that I try aren't working.

I've tried adding a \n (including \r\n) at each intended break location, as well as <br />. With the \n, it doesn't print \n on the screen, it essentially ignores it, and with the <br />, it just prints <br /> to the screen where I want the line breaks.

I also read to use Environment.NewLine, but if that's even the solution to my problem, I'm not sure how to concatenate that onto the end of my string.

Please let me know of any other ideas or solutions you may have!

EDIT: Finally found an answer - Converting String to raw html

1

There are 1 answers

1
Craig On

Have you tried &lt;br/&gt;? If you don't escape the '<' and '>' the renderer probably doesn't know they're not just plain text.