Hey All,
I store some large text fields in my database. When i view it in a ASP page it loses all it's formatting in particular Enters are missing.
Whats an easy way to keep the text formatted as like it was when it went in?
cheers for any help
b :)
Printable View
Hey All,
I store some large text fields in my database. When i view it in a ASP page it loses all it's formatting in particular Enters are missing.
Whats an easy way to keep the text formatted as like it was when it went in?
cheers for any help
b :)
I'm sure there is a better way..but off the top of my head:
Code:Message = Replace(request.form("txtMessage"), vbcrlf, "<br>")
rs("Message") = Message
yeah i use that now i was hoping there'd be a server function or something that someone knows of??
thanks rdove! :)
I'n not sure that I understand the problem. I have a page which displays text from a MEMO type field in a MS Access database! If the user has inputted an ENTER keypress then the ENTER is remembered. It also works with "<br>" so instead of writing a lot of functions maybe you should try to change the format of your field to MEMO insted of CHAR or VARCHAR or whatever you are using...
Enjoy
MC
I have a memo field in my Access DB and it doesn't keep the formatting....
Remember that a carriage return in text does not translate to a carriage return in HTML. You either have to replace them with <br>'s, as someone metioned earlier, or you have to use the
<pre> tag for preformatted text.
VB Code:
Response.write Replace(Recordset.Fields.item("message").value, vbCrLf, "<br>") or . . . Response.write "<pre>" & Recordset.Fields.item("message").value & "</pre>"