473,421 Members | 1,469 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,421 software developers and data experts.

Carriage Return and Response.Write Output Issue

I have a field in a SQL Server table named DetailedDescription that is
a varchar. If the user adds/edits a detailed description, they do so
in a MulltiLine TextBox control. Therefore, they are able to click
enter on their keyboard and have multiple carriage returns inside the
DetaildDescription.

My problem is that I have another webpage in my project that has the
following statement in it:
Response.Write(drSQL.Item("DetailDescription")).

If the user created a record in the following format:
HELLO
WORLD

It is now displayed as:
HELLO WORLD

Is there something I can add to my Response.Write statement so that the
carriage returns are "written" so that the output is in the following
format:
HELLO
WORLD

I hope this makes sense.
Thanks,
CR Junk

Oct 11 '06 #1
8 11103
Response.Write(Replace(vbCrLf, "<br>"))

"crjunk" <cr****@earthlink.netwrote in message
news:11**********************@c28g2000cwb.googlegr oups.com...
>I have a field in a SQL Server table named DetailedDescription that is
a varchar. If the user adds/edits a detailed description, they do so
in a MulltiLine TextBox control. Therefore, they are able to click
enter on their keyboard and have multiple carriage returns inside the
DetaildDescription.

My problem is that I have another webpage in my project that has the
following statement in it:
Response.Write(drSQL.Item("DetailDescription")).

If the user created a record in the following format:
HELLO
WORLD

It is now displayed as:
HELLO WORLD

Is there something I can add to my Response.Write statement so that the
carriage returns are "written" so that the output is in the following
format:
HELLO
WORLD

I hope this makes sense.
Thanks,
CR Junk

Oct 11 '06 #2
crjunk wrote:
I have a field in a SQL Server table named DetailedDescription that is
a varchar. If the user adds/edits a detailed description, they do
so in a MulltiLine TextBox control. Therefore, they are able to
click enter on their keyboard and have multiple carriage returns
inside the DetaildDescription.

My problem is that I have another webpage in my project that has the
following statement in it:
Response.Write(drSQL.Item("DetailDescription")).

If the user created a record in the following format:
HELLO
WORLD

It is now displayed as:
HELLO WORLD

Is there something I can add to my Response.Write statement so that
the carriage returns are "written" so that the output is in the
following format:
HELLO
WORLD
A. Display the data in a textarea instead of response.writing it into
the html
B. Surround the data in <PRE></PREtags
C. Replace the carriage returns with <BR- this is basic html.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Oct 11 '06 #3
Thanks for the responses. I ended up using Gomer's suggeetion.

CR Junk

Oct 13 '06 #4
Hi, if i were you, i would use the same as Gomer's but with little
modification
Response.Write(replace(drSQL.Item("DetailDescripti on"),chr(13),"<BR>")

what i did is that i replaced the vbCrLf to chr(13), because the vbCrLf
is combination of chr(13) and chr(10), so what if the user had used a
format that he only included the chr(13), then if you use the vbCrLf it
will not work, because using the vbCrlf will look for the two at once
which only one is available. And by the way, according to me testings,
chr(13) is required for the enter more than the chr(10) which means
chr(10) is always to occure.
And if you still want to use his advice, then use it this way: use vbCr
instead of chr(13)
Best Regards
Firas S Assaad
crjunk wrote:
Thanks for the responses. I ended up using Gomer's suggeetion.

CR Junk
Oct 17 '06 #5

"Firas" <fi******@gmail.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.com...
Hi, if i were you, i would use the same as Gomer's but with little
modification
Response.Write(replace(drSQL.Item("DetailDescripti on"),chr(13),"<BR>")

what i did is that i replaced the vbCrLf to chr(13), because the vbCrLf
is combination of chr(13) and chr(10), so what if the user had used a
format that he only included the chr(13), then if you use the vbCrLf it
will not work, because using the vbCrlf will look for the two at once
which only one is available. And by the way, according to me testings,
chr(13) is required for the enter more than the chr(10) which means
chr(10) is always to occure.
And if you still want to use his advice, then use it this way: use vbCr
instead of chr(13)
There are two end-of-line markers in common use. CRLF or just plain LF.
I've not come across many (in fact never have) systems that only use CR.
What tests did you use to discover that CR on it's own is more common or
indeed ever happens at all?

My solution BTW is :-

Replace(Replace(Server.HTMLEncode(s), vbCR, ""), vbLF, "<br />")

>
Best Regards
Firas S Assaad
crjunk wrote:
Thanks for the responses. I ended up using Gomer's suggeetion.

CR Junk

Oct 17 '06 #6
we're talking about someone hitting the enter key in text area on a web
page...
how would this ever be translated into anything other than crlf??
"Anthony Jones" <An*@yadayadayada.comwrote in message
news:eN**************@TK2MSFTNGP04.phx.gbl...
>
"Firas" <fi******@gmail.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.com...
>Hi, if i were you, i would use the same as Gomer's but with little
modification
Response.Write(replace(drSQL.Item("DetailDescript ion"),chr(13),"<BR>")

what i did is that i replaced the vbCrLf to chr(13), because the vbCrLf
is combination of chr(13) and chr(10), so what if the user had used a
format that he only included the chr(13), then if you use the vbCrLf it
will not work, because using the vbCrlf will look for the two at once
which only one is available. And by the way, according to me testings,
chr(13) is required for the enter more than the chr(10) which means
chr(10) is always to occure.
And if you still want to use his advice, then use it this way: use vbCr
instead of chr(13)

There are two end-of-line markers in common use. CRLF or just plain LF.
I've not come across many (in fact never have) systems that only use CR.
What tests did you use to discover that CR on it's own is more common or
indeed ever happens at all?

My solution BTW is :-

Replace(Replace(Server.HTMLEncode(s), vbCR, ""), vbLF, "<br />")

>>
Best Regards
Firas S Assaad
crjunk wrote:
Thanks for the responses. I ended up using Gomer's suggeetion.

CR Junk


Oct 17 '06 #7
I think that's exactly Anthony's question. Perhaps Firas is aware of a
browser that will use vbCr instead of vbCrLf.

XML noob wrote:
we're talking about someone hitting the enter key in text area on a
web page...
how would this ever be translated into anything other than crlf??
"Anthony Jones" <An*@yadayadayada.comwrote in message
news:eN**************@TK2MSFTNGP04.phx.gbl...
>>
"Firas" <fi******@gmail.comwrote in message
news:11**********************@m7g2000cwm.googlegr oups.com...
>>Hi, if i were you, i would use the same as Gomer's but with little
modification
Response.Write(replace(drSQL.Item("DetailDescripti on"),chr(13),"<BR>")
>>>
what i did is that i replaced the vbCrLf to chr(13), because the
vbCrLf is combination of chr(13) and chr(10), so what if the user
had used a format that he only included the chr(13), then if you
use the vbCrLf it will not work, because using the vbCrlf will look
for the two at once which only one is available. And by the way,
according to me testings, chr(13) is required for the enter more
than the chr(10) which means chr(10) is always to occure.
And if you still want to use his advice, then use it this way: use
vbCr instead of chr(13)

There are two end-of-line markers in common use. CRLF or just plain
LF. I've not come across many (in fact never have) systems that only
use CR. What tests did you use to discover that CR on it's own is
more common or indeed ever happens at all?

My solution BTW is :-

Replace(Replace(Server.HTMLEncode(s), vbCR, ""), vbLF, "<br />")

>>>
Best Regards
Firas S Assaad
crjunk wrote:
Thanks for the responses. I ended up using Gomer's suggeetion.

CR Junk
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Oct 17 '06 #8

"XML noob" <le**@s.comwrote in message
news:Ox**************@TK2MSFTNGP02.phx.gbl...
we're talking about someone hitting the enter key in text area on a web
page...
how would this ever be translated into anything other than crlf??
If you pass stuff around via XML you will find CRLFs being converted to just
LFs.
>
"Anthony Jones" <An*@yadayadayada.comwrote in message
news:eN**************@TK2MSFTNGP04.phx.gbl...

"Firas" <fi******@gmail.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.com...
Hi, if i were you, i would use the same as Gomer's but with little
modification
Response.Write(replace(drSQL.Item("DetailDescripti on"),chr(13),"<BR>")

what i did is that i replaced the vbCrLf to chr(13), because the vbCrLf
is combination of chr(13) and chr(10), so what if the user had used a
format that he only included the chr(13), then if you use the vbCrLf it
will not work, because using the vbCrlf will look for the two at once
which only one is available. And by the way, according to me testings,
chr(13) is required for the enter more than the chr(10) which means
chr(10) is always to occure.
And if you still want to use his advice, then use it this way: use vbCr
instead of chr(13)
There are two end-of-line markers in common use. CRLF or just plain LF.
I've not come across many (in fact never have) systems that only use CR.
What tests did you use to discover that CR on it's own is more common or
indeed ever happens at all?

My solution BTW is :-

Replace(Replace(Server.HTMLEncode(s), vbCR, ""), vbLF, "<br />")

>
Best Regards
Firas S Assaad
crjunk wrote:
Thanks for the responses. I ended up using Gomer's suggeetion.

CR Junk


Oct 17 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Canes_Rock | last post by:
The information posted at: ...
3
by: Guy Verville | last post by:
I'm perplexed, I have several forms that seem to be ok, but what is sent by email doesn't contain all the Carriage returns sent. The form contains many fields and is sent as follow:...
4
by: Lauren Quantrell | last post by:
I have created the following trigger: CREATE TRIGGER ON OutputTable FOR INSERT AS Declare @filename nvarchar(35) Declare @filecontents nvarchar(2000) Declare @strcmdshell varchar(150)
4
by: Dr. Laurence Leff | last post by:
I am writing a Java program to read in XML file, modify some elements slightly, and then write it out. That XML file is prepared in Docbook. It works fine, except that it is disturbing the...
6
by: Tony Stoker | last post by:
I have a .Net web app that adds a record to a SQL database. After the user adds their record I want to have a link that will link them to their new record! The recordID is a AutoNumber in the...
2
by: Andrew Chanter | last post by:
I have a VBA function that returns a string including "vbcr" (VB Carriage Return) to seperate a list into multiple rows, eg Item1 & vbcr & Item2 & vbcr & Item3 This works as planned in the...
12
by: Nimmy | last post by:
Hi, I have a data file and I want to remove Carriage returns. Any one has any C code/program which does this? I am working on Windows XP machine.....I don't have access to UNIX machine. But I...
0
by: thelane | last post by:
I am parsing an xml file with the DOM api and it is reading my carriage returns. When I try to output the values from the xml to a flat file, it is going on to a new line because of the carriage...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.