I have a string that I save to a database. Problem is it only displays the line feed when I am in the edit mode form. When I just display it (no editing) in my webpage or use it in an email the string displays with no line feeds and it is all run together (See pictures below). I'm using MVC 4 and VS2012.
Can anyone please tell me how to get the line feeds to always display?
The string is generated from a form with the following code:
string LF = " \r\n ";
//string LF = Environment.NewLine; // tried this also, did'nt work.
string appendComments = " ";
contact.Subject = "Quick Quote";
appendComments += "Make Sure to Contact Customer by: " + Request.Form["radio"].ToString(); ;
appendComments += LF + LF + "CARPET CLEANING: " + LF;
if ((Request.Form["bedRms"]) != "0") { appendComments += "Bedrooms =" + Request.Form["bedRms"] + ", " + LF; }
if ((Request.Form["familyRm"]) != "false" || (Request.Form["familyRm"]) == "on" ) { appendComments += "Family Room = Yes, " + LF; }
if ((Request.Form["livingRm"]) != "false" || (Request.Form["livingRm"]) == "on") { appendComments += "Living Room = Yes, " + LF; }
if ((Request.Form["diningRm"]) != "false" || (Request.Form["diningRm"]) == "on") { appendComments += "Dining Room = Yes, " + LF; }
if ((Request.Form["ld-combo"]) != "false" || (Request.Form["ld-combo"]) == "on") { appendComments += "Living/Dining Combo = Yes, " + LF; }
if ((Request.Form["pets"]) != "false" || (Request.Form["pets"]) == "on") { appendComments += "Pet Spot/Stain Issue = Yes " + LF; }
Here I save it to the database.
Line Feed Works in the Edit Form: works in edit form http://www.leadingedgewebsites.com/linefeedworks.jpg
Line Feed Does Not Work When Displaying it on the webpage: Does Not Work on Webpage http://www.leadingedgewebsites.com/linefeednowork.jpg
Line Feed Does Not Work on Email: Does Not Work in email http://www.leadingedgewebsites.com/inemail.jpg
I do appreciate you taking the time to help me.
Thank you.
for HTML (pages and e-mails) or \par for RTF emails (\n for plain text e-mails). – Adriano Repetti Oct 11 '13 at 13:53
` instead of `\r\n` – Ahmed KRAIEM Oct 11 '13 at 13:53