7

I have some problems with the ASP.NET Literal control because it isn't rendering the <br/> tag.

code

string strTemp = task.Description.ToString();
lit_description.Text = strTemp.Replace("\r\n", "<br/>");

output:

LG SERVICE TICKET<br/><br/> <br/><br/>- DATE IN (eg. Feb 11, 2011):<br/><br/>- DATE OUT (eg. Feb 11, 2011):<br/><br/>- Client Has Critical Data (fees will apply):<br/><br/>- Windows Password: <br/><br/>- Accessories:<br/><br/><br/><br/><br/>Client Complaint:<br/><br/><br/><br/>
Tim Schmelter
  • 450,073
  • 74
  • 686
  • 939
  • Why you dont try use spans that you will then display as blocks.

    LG SERVICE TICKETDATE

    http://stackoverflow.com/questions/2703601/how-to-give-line-break-from-css-without-using-br
    – danywalls Jan 22 '13 at 16:53

1 Answers1

11

Set it's Mode to PassThrough:

<asp:Literal Id="lit_description" Mode="PassThrough"></asp:Literal>

PassThrough The contents of the control are not modified.

Tim Schmelter
  • 450,073
  • 74
  • 686
  • 939