1

I fear this is a dumb question, but I can't seem to find the answer. Pretty sure what that makes me......

I have C# generated HTML (HtmlGenerator), to which I sometimes want to insert a line break at a certain part of a cell's innertext.

Here is how that comes out:

<TD >There are lots of extra &lt; br /&gt; words here </TD>

This then displays the <br/> as a part of my cell text - not good.

Am I missing an easy way to have the <br/> preserved and not converted to &lt, etc...?

thanks

Josh Darnell
  • 11,096
  • 9
  • 36
  • 63
Chris
  • 203
  • 1
  • 2
  • 4

3 Answers3

1

I think you want HttpUtility.HtmlDecode. See this SO thread.

Community
  • 1
  • 1
Tom
  • 21,211
  • 4
  • 63
  • 93
0

You probably should put real newlines (\n) into your text to be converted. Then, if the HtmlGenerator doesn't convert those to <br> afterwards, you can use a standard string replace yourself.

Chris Jester-Young
  • 213,251
  • 44
  • 377
  • 423
0

If this table cell fragment is generated programmatically (in C# for example) then Environment.NewLine could be what you are after.

amelvin
  • 8,819
  • 4
  • 37
  • 59