|
-
Feb 10th, 2003, 11:42 PM
#1
Thread Starter
PowerPoster
ASP- Text formatting from database
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
-
Feb 10th, 2003, 11:49 PM
#2
Addicted Member
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
-
Feb 11th, 2003, 12:05 AM
#3
Thread Starter
PowerPoster
yeah i use that now i was hoping there'd be a server function or something that someone knows of??
thanks rdove!
-
Feb 11th, 2003, 02:58 AM
#4
Lively Member
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
Enjoy...
----
If something is hard to do then it aint worth doing!!
-
Feb 11th, 2003, 08:27 AM
#5
Addicted Member
I have a memo field in my Access DB and it doesn't keep the formatting....
-
Feb 11th, 2003, 08:41 AM
#6
Addicted Member
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>"
Wydok
"It would appear that we have reached the limits of what it is possible to achieve with computer technology, although one should be careful with such statements, as they tend to sound pretty silly in 5 years."
-John Von Neumann ca. 1949
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|