|
 |
asp_databases thread: RE: How to retain linebreaks in text submitted to
db?
Message #1 by "Peter Foti (PeterF)" <PeterF@S...> on Fri, 19 Apr 2002 10:43:04 -0400
|
|
Mark,
Save the text in the database just as the user entered it. Then when
you display the text, do the replace that Ron suggested:
<%
' Assume you create a recordset (oRS) and the field you want is called
myText
sText = Replace(oRS("myText"), vbCrLf, "<br>")
Response.Write( sText )
%>
Note that if you want to create a little more space between the line
breaks, you could do this:
sText = Replace(oRS("myText"), vbCrLf, "<br><br>")
Keep in mind that you should do this replace when viewing the contents,
not when storing them. This way, you are storing the data contents and
presentation can be applied separately. For example, on one page, you
might want the presentation to have no extra line of space so you would
only do the replace with a single "<br>", but on another page you might
want to display the data with larger gaps between the lines, so you
could do the replace with multiple "<br>".
Hope this helps,
Pete
> -----Original Message-----
> From: Mark Vorreuter [mailto:sherwood00@h...]
> Sent: Friday, April 19, 2002 1:25 AM
> To: ASP Databases
> Subject: [asp_databases] How to retain linebreaks in text submitted to
> db?
>
>
> We are collecting information online and when I submit the
> text to the
> access db all linebreaks are removed and when the text is
> displayed the
> text runs on without linebreaks. Someone recently mentioned that cold
> fusion has a paragraphformat tag. Is there something similar in ASP?
>
Message #2 by "Mark Vorreuter" <sherwood00@h...> on Fri, 19 Apr 2002 01:25:12
|
|
We are collecting information online and when I submit the text to the
access db all linebreaks are removed and when the text is displayed the
text runs on without linebreaks. Someone recently mentioned that cold
fusion has a paragraphformat tag. Is there something similar in ASP?
Message #3 by "Drew, Ron" <RDrew@B...> on Thu, 18 Apr 2002 21:36:01 -0400
|
|
Dim sText ' This is the string that holds the text with the line breaks
sText =3D Replace(sText, vbCRLF, "<BR>")
This will replace ALL the linebreaks in the text to their HTML
equivalent <BR>.
-----Original Message-----
From: Mark Vorreuter [mailto:sherwood00@h...]
Sent: Thursday, April 18, 2002 9:25 PM
To: ASP Databases
Subject: [asp_databases] How to retain linebreaks in text submitted to
db?
We are collecting information online and when I submit the text to the
access db all linebreaks are removed and when the text is displayed the
text runs on without linebreaks. Someone recently mentioned that cold
fusion has a paragraphformat tag. Is there something similar in ASP?
Message #4 by "Owen Mortensen" <ojm@a...> on Thu, 18 Apr 2002 17:20:06 -0700
|
|
<pre>
-----Original Message-----
From: Mark Vorreuter [mailto:sherwood00@h...]
Sent: Friday, April 19, 2002 1:25 AM
To: ASP Databases
Subject: [asp_databases] How to retain linebreaks in text submitted to
db?
We are collecting information online and when I submit the text to the
access db all linebreaks are removed and when the text is displayed the
text runs on without linebreaks. Someone recently mentioned that cold
fusion has a paragraphformat tag. Is there something similar in ASP?
|
|
 |