473,503 Members | 2,082 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Displaying text in an asp.net table

I am using an asp.net table to display postings in a classifieds website.

This is a section of the HTM I am using...

<asp:table id="tblAdvert" Width="466px" Height="78px" runat="server"
BackColor="Gainsboro" BorderStyle="Solid" BorderWidth="1px"
BorderColor="MidnightBlue" GridLines="Both" CellSpacing="0">
<asp:TableRow>
<asp:TableCell></asp:TableCell>
</asp:TableRow>
...
<asp:TableRow>

And then I fill the table like this (in the code-behind) ...
tblAdvert.Rows(3).Cells(0).Text = advert.Description

The problem is that the text all gets displayed in one paragraph, even
though the user

might have added lines when they entered the posting.

So I tried this...
tblAdvert.Rows(3).Cells(0).Text = "<pre class=advertdescription>" &
advert.Description &

"</pre>"

This expands the table so that it stretches out, and the user has to scroll
horizontally

to see the whole posting.

Any suggestions ? Thanks,
Craig
Nov 22 '05 #1
2 2817
I think, but I'm not an ASP/HTML programmer really that you need to replace
the new line char (chr(13)) in your text to a break row in HTML (<br>????)

Hope it sparks an idea.
Chris

"Craig HB" <Cr*****@discussions.microsoft.com> wrote in message
news:11**********************************@microsof t.com...
I am using an asp.net table to display postings in a classifieds website.

This is a section of the HTM I am using...

<asp:table id="tblAdvert" Width="466px" Height="78px" runat="server"
BackColor="Gainsboro" BorderStyle="Solid" BorderWidth="1px"
BorderColor="MidnightBlue" GridLines="Both" CellSpacing="0">
<asp:TableRow>
<asp:TableCell></asp:TableCell>
</asp:TableRow>
...
<asp:TableRow>

And then I fill the table like this (in the code-behind) ...
tblAdvert.Rows(3).Cells(0).Text = advert.Description

The problem is that the text all gets displayed in one paragraph, even
though the user

might have added lines when they entered the posting.

So I tried this...
tblAdvert.Rows(3).Cells(0).Text = "<pre class=advertdescription>" &
advert.Description &

"</pre>"

This expands the table so that it stretches out, and the user has to
scroll
horizontally

to see the whole posting.

Any suggestions ? Thanks,
Craig

Nov 22 '05 #2
Craig HB wrote:
I am using an asp.net table to display postings in a classifieds website.

This is a section of the HTM I am using...

<asp:table id="tblAdvert" Width="466px" Height="78px" runat="server"
BackColor="Gainsboro" BorderStyle="Solid" BorderWidth="1px"
BorderColor="MidnightBlue" GridLines="Both" CellSpacing="0">
<asp:TableRow>
<asp:TableCell></asp:TableCell>
</asp:TableRow>
...
<asp:TableRow>

And then I fill the table like this (in the code-behind) ...
tblAdvert.Rows(3).Cells(0).Text = advert.Description

The problem is that the text all gets displayed in one paragraph, even
though the user

might have added lines when they entered the posting.

So I tried this...
tblAdvert.Rows(3).Cells(0).Text = "<pre class=advertdescription>" &
advert.Description &

"</pre>"

This expands the table so that it stretches out, and the user has to
scroll horizontally

to see the whole posting.

Any suggestions ? Thanks,
Craig

Any characters such as line feeds, carriage returns, tabs, end of page, are
ignored. They are called whitespace in the Web. Will not display except
within a <pre> element.
Nov 22 '05 #3

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

Similar topics

14
2571
by: Akbar | last post by:
Hey there, Big-time curiosity issue here... Here's the test code (it's not that long)... it's to display a large number of image links with captions, ideally pulled in from an external file...
9
2324
by: Susan Bricker | last post by:
Greetings. I am having trouble populating text data that represents data in my table. Here's the setup: There is a People Table (name, address, phone, ...) peopleID = autonumber key There...
0
1708
by: Fronky | last post by:
Hope someone can help. I am still learning, so no laughing please. I am displaying records from a database using Response.Write(""); instead of the usual datagrid method. I am doing it this way...
9
4547
by: Cogito | last post by:
My program builds several tables using inner HTML. All the tables are displayed only when the program terminates. How can I make it display one table at a time and then wait for a click before...
10
5723
by: gnewsgroup | last post by:
I've googled and tried various approaches, but could not resolve this problem. The article at MSDN: Displaying Images in a GridView Column only presents a simple case where all data (including the...
11
2403
by: dba | last post by:
Have been displaying data from database using html for some time but just recently trying to display data back to "form". Can't find answer. <form method="post" action="<?php echo $PHP_SELF;?>">...
1
4183
by: littlealex | last post by:
IE6 not displaying text correctly - IE 7 & Firefox 3 are fine! Need some help with this as fairly new to CSS! In IE6 the text for the following page doesn't display properly - rather than being...
7
2390
by: hsegoy1979 | last post by:
Dear All Iam using file upload control and i want to display image in another pop up page .But image is not displaying in image control iam sending image path thru querystring . here is my code ...
7
5407
by: EManning | last post by:
I'm using A2003 connected to a SQL 2000 backend. This is not an adp. I have a table which I store 0 and -1 for 2 bit fields. I have a listbox on a form based on a query of this table. The...
482
27256
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place. ...
0
7205
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
7093
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...
0
7287
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
7468
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
5596
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,...
1
5023
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...
0
3180
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...
0
3170
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
747
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.