473,545 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Carriage Return and Response.Write Output Issue

I have a field in a SQL Server table named DetailedDescrip tion 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
DetaildDescript ion.

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

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 11119
Response.Write( Replace(vbCrLf, "<br>"))

"crjunk" <cr****@earthli nk.netwrote in message
news:11******** **************@ c28g2000cwb.goo glegroups.com.. .
>I have a field in a SQL Server table named DetailedDescrip tion 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
DetaildDescript ion.

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

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 DetailedDescrip tion 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 DetaildDescript ion.

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

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.writin g 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.I tem("DetailDesc ription"),chr(1 3),"<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.goog legroups.com...
Hi, if i were you, i would use the same as Gomer's but with little
modification
Response.Write( replace(drSQL.I tem("DetailDesc ription"),chr(1 3),"<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.HTMLEnc ode(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*@yadayadaya da.comwrote in message
news:eN******** ******@TK2MSFTN GP04.phx.gbl...
>
"Firas" <fi******@gmail .comwrote in message
news:11******** **************@ m7g2000cwm.goog legroups.com...
>Hi, if i were you, i would use the same as Gomer's but with little
modification
Response.Write (replace(drSQL. Item("DetailDes cription"),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.HTMLEnc ode(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*@yadayadaya da.comwrote in message
news:eN******** ******@TK2MSFTN GP04.phx.gbl...
>>
"Firas" <fi******@gmail .comwrote in message
news:11******* *************** @m7g2000cwm.goo glegroups.com.. .
>>Hi, if i were you, i would use the same as Gomer's but with little
modificatio n
Response.Write( replace(drSQL.I tem("DetailDesc ription"),chr(1 3),"<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(Replac e(Server.HTMLEn code(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.comwrot e in message
news:Ox******** ******@TK2MSFTN GP02.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*@yadayadaya da.comwrote in message
news:eN******** ******@TK2MSFTN GP04.phx.gbl...

"Firas" <fi******@gmail .comwrote in message
news:11******** **************@ m7g2000cwm.goog legroups.com...
Hi, if i were you, i would use the same as Gomer's but with little
modification
Response.Write( replace(drSQL.I tem("DetailDesc ription"),chr(1 3),"<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.HTMLEnc ode(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
9266
by: Canes_Rock | last post by:
The information posted at: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=slrnarv28n.e4j.TuxTrax%40fortress.tuxnet&rnum=1&prev=/groups%3Fq%3Dsuppress%2Bcarriage%2Breturn%2Bgroup:comp.lang.python.*%26hl%3Den%26lr%3D%26ie%3DUTF-8%26group%3Dcomp.lang.python.*%26selm%3Dslrnarv28n.e4j.TuxTrax%2540fortress.tuxnet%26rnum%3D1 seemed to...
3
1777
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
7417
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
9867
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 carriage returns in places where they have meaning. Attached are a sample input file, the sample output file, and a simplified version of my Java...
6
2360
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 SQL server... How do I return the recordID after I have added the record?
2
4116
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 immediate window, producing a list where a Carriage Return follows each item. But when I output the result into either an Access query or form, instead...
12
5594
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 need to send this data file to the Unix machine once I remove the carriage retunrns from my XP machine. Thanks
0
1806
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 return So how do I ignore the carriage return or convert it to nothing. Alos, how would I go on to a new line in my file.
0
7473
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7406
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7660
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7431
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5976
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4949
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3457
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1020
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.