472,990 Members | 3,684 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

ASP - HTML not recognising line break

I am posting data to a sql server database via an asp web form. When
retreiving the data the information is all concatenated on one line
i.e.
When posting in textarea the format looks like:

1. information
2. information
3. information

but when retreiving the data it looks like:

1. information2. information3. information

I am storing the data in type ntext and when i look in the database
the data is correctly formated on seperate lines. Can anyone help ?
Jul 20 '05 #1
3 9216
stuart wrote:
I am posting data to a sql server database via an asp web form. When
retreiving the data the information is all concatenated on one line
i.e.
When posting in textarea the format looks like:

1. information
2. information
3. information

but when retreiving the data it looks like:

1. information2. information3. information

I am storing the data in type ntext and when i look in the database
the data is correctly formated on seperate lines. Can anyone help ?


browsers will concatenate whitespace. experiment with formating. perhaps
start with: convert cr/lf to <br>

--
William Tasso - http://WilliamTasso.com
Jul 20 '05 #2
st*************@kellogg.com (stuart) wrote:
I am posting data to a sql server database via an asp web form. When
retreiving the data the information is all concatenated on one line
i.e.
When posting in textarea the format looks like:

1. information
2. information
3. information

but when retreiving the data it looks like:

1. information2. information3. information


Yes, the same result that you would get if you had typed

1. information
2. information
3. information

directly into a static web page in a text editor. HTML treats new-line
characters as white space, not as new lines. To produce a line break
in HTML, you use the <br> tag. So if you want to display data that
contains new-line characters in HTML, and you want the line breaks to
appear in the browser, you need to replace them with "<br>":

Response.Write Replace(myText, chr(13) & chr(10), "<br>")
--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 20 '05 #3
On Thu, 15 Jan 2004, stuart wrote:
I am posting data to a sql server database via an asp web form. When
retreiving the data the information is all concatenated on one line
i.e.
When posting in textarea the format looks like:

1. information
2. information
3. information

but when retreiving the data it looks like:

1. information2. information3. information
I don't believe that the _data_ looks like that. Maybe that's what
you're seeing after the data has been erroneously processed as if it
were HTML.

Your chief problem here is that you've got so many complicating
factors in your problem that you've lost touch with reality. Suppose
that you coded an HTML source like that:

1. information
2. information
3. information

without any HTML markup, and then fed it to a browser. What would you
expect to see?
when i look in the database the data is correctly formated


But with respect, since you seem to be confused about what is
"correct", I think we need to be told just exactly what you found
there, rather than merely that you considered it to be "correct".

Textarea submission is defined to include the newlines that were
contained in the submitted data. Based on what you're reporting as
input, it appears that you are in fact submitting newlines. Those
newlines, if sent to a browser, *ought* to be treated as white space.
If that was the case, then I would expect to see:

1. information 2. information 3. information

which is different from what you're reporting.

Finally, don't forget to tell us what it is that you're trying to
achieve. Is the user supposed to be supplying HTML markup into the
text area, or are they supposed to be supplying plain-text and your
software is supposed to be applying appropriate markups to that?

good luck
Jul 20 '05 #4

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

Similar topics

2
by: IceOnFire | last post by:
I am working on a script to extract statistics (which is updated daily) from a website, and insert them into a MySQL database. I want to take this website:...
30
by: just say NO to PDF | last post by:
Here's the scoop: Does anyone remember the UNIX utility "pretty" for formatting C code? What I'm looking for is a utility that will do two things: 1) Format the HTML code itself to make it...
2
by: Mitch | last post by:
I have some simple HTML I'm trying to read with the XMLTextReader. As in the MSDS examples, I set up a loop to read each XML node: while (reader.Read()) { switch (reader.NodeType) { case...
4
by: Rick | last post by:
I am fairly new to XML, I have an XML document that holds configurations for an ASP.NET application, within the configuration XML File I have a line of text that will feed into a lable on a web...
9
by: MW de Jager | last post by:
Hi all I'm not an HTML programmer so please excuse my ignorance. I am trying to force text to display on the next line, but I do not want an emply line between lines of text. Option1...
10
by: Eric Lindsay | last post by:
This may be too far off topic, however I was looking at this page http://www.hixie.ch/advocacy/xhtml about XHTML problems by Ian Hickson. It is served as text/plain, according to Firefox...
6
by: McKirahan | last post by:
I an using ASP to read a database table and generate an HTML table which is save via FSO with a file extension of .xls which opens up in MS-Excel. I am inserting several lines of text into a cell...
2
by: Sunfire | last post by:
I was wondering if there was a way to hit enter to insert blank lines while in the designer? I tried this but all it seems to want to do is insert code that really shouldn't be there. For example,...
23
by: andrew | last post by:
Hi, I have been taken to task about the length of lines in the source html of: http://www.slrn.sourceforge.org which, as I commonly do, has no line breaks at all in the source html. My...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.