Why am I losing formatting (carriage returns) in ASP.NET web textbox control?
Posted on 2004-03-31
I am maintaining a web site using ASP.NET. I have a Web text box control on one form used for data entry that is multi-line with scroll bars displayed a large amount of text, 6-7 pages worth, with formatting such as carriage returns so it looks decent. I have to take the contents of this textbox, along with some of the other fields on the data entry form, and transfer it to a textbox on another form used to Print. The only difference on the print page is all the text must be displayed on one page, so no scroll bars or multiline for the text box so it'll expand to fit the text. It does but I lose all my formatting! Tried label and same thing - all the carriage returns within the text disappear so it looks awful. Why am I losing my formatting and how do I preserve it from one web page to another? Found one article that said to use Server.HTMLEncode but that didn't help. Also tried replacing vbcrlf with html <BR> as per another article, that didn't work either.
I'm expected to have this working today so - help!