|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Database - Recordset - Split VeryLongWords To Prevent Table Stretching
Hi everybody,
I have a recordset that returns an item ("description") that users have previously submitted into the database, and which can be up to 1000 characters long. The table that displays the item ("description") is 800 pixels wide (equivalent to 80 x "W" character), but if some idiot enters a ridiculously long word (e.g. 1000 x "W" character, the table stretches and the page looks awful. I tried Splitting the item("description") at 80 characters. I'm not an expert yet, so it only split once, rather than every 80 characters. I guess I need to Loop somewhere but I haven't worked this out yet. Even if I did split it every 80 characters, there could still be situations where the table stretches because the first part of a line could be array(cnt) followed by an 80 character array(cnt+1). I think that this could be solved if I added a condition that inserted a break between array(cnt) and array(cnt+1) if the sum of the length of array(cnt) plus the length of array(cnt+1) is greater than 80 characters, but I'm not sure if this is the right way to go. Can someone please offer me some advice about whether split is the right function to use in this scenario and what I should be doing with it? |
|
#2
|
||||
|
||||
|
i don't see the point in splitting the data, why not just apply a CSS Style to the cell. something like this:
Code:
<td style="word-wrap: break-word;">Whatever the data is</td>
__________________
Come JOIN the party!!! Quote of the Month: Trouble: Luck can't last a lifetime unless you die young. Questions to Ponder: Do cemetery workers prefer the graveyard shift? iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm") copyright© 2008 sbenj69 |
|
#3
|
|||
|
|||
|
Thanks mehere,
I tried inserting your code as follows; Code:
.style105 {color: #0099FF; word-wrap: break-word;}
and Code:
<td><p class="style105"><%=(rs_listing_act.Fields.Item("proj_description").Value)%> </p></td>
But it made no difference. Have I done it wrong? p.s. I erroneously referred to the item as "description", whereas it's blatantly "proj_description" - apologies if this causes any confusion. |
|
#4
|
||||
|
||||
|
try adding this to the table tag
Code:
<table style="width: 100%; table-layout: fixed;"> if this fixes the issue, i will move this thread to the CSS, HTML, Javascript forum |
|
#5
|
|||||
|
|||||
|
a little more research brings me to the fact that the word-wrap in CSS is IE specific ... what you can do is this:
add this to you CSS css Code:
then add the table-layout: fixed to your table tag, then just surround your text in the td tag with the PRE tag Code:
<table style="width: 100%; table-layout:fixed;">
<tr>
<td><pre><%=rs("description")%></pre></td>
</tr>
</table>
|
|
#6
|
|||
|
|||
|
That works fine.
I've spent ages trying to work out how to do it. If only I knew then . . . Thanks very much. |
|
#7
|
||||
|
||||
|
np ... glad it's working for you.
|
![]() |
| Viewing: ASP Free Forums > Programming > HTML, JavaScript And CSS Help > Database - Recordset - Split VeryLongWords To Prevent Table Stretching |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|