Using C# I have a WPF text box which accepts carriage returns. It saves into the SQL database as a carriage return (I have checked the ASCII on this) but when the application pulls it from the database and into a string and then prints it using HTML with no carriage return. How can I get the string to recognize the carriage return?
HTML doesn't display new lines based on carriage return, it uses specific markup: <br/>
Quick fix would be to convert all your new lines before rendering it as html...
string html = text.Replace(Environment.NewLine, "<br/>");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.