HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old May 9th, 2008, 06:38 AM
foreverforever foreverforever is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 16 foreverforever User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 h 26 m 9 sec
Reputation Power: 0
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?

Reply With Quote
  #2  
Old May 9th, 2008, 07:28 AM
mehere's Avatar
mehere mehere is offline
Senior Sarcasm Wizardess
Click here for more information.
 
Join Date: Feb 2005
Location: Dreamland
Posts: 12,645 mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)  Folding Points: 10976 Folding Title: Novice Folder
Time spent in forums: 4 Months 3 Weeks 5 Days 18 h 58 m 26 sec
Reputation Power: 1542
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:
Stupidity: Quitters never win, winners never quit, but those who never win AND never quit are idiots.

Questions to Ponder:
If man evolved from monkeys and apes, why do we still have monkeys and apes?

iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm")
copyright© 2008 sbenj69

Reply With Quote
  #3  
Old May 9th, 2008, 07:44 AM
foreverforever foreverforever is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 16 foreverforever User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 h 26 m 9 sec
Reputation Power: 0
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.

Reply With Quote
  #4  
Old May 9th, 2008, 08:04 AM
mehere's Avatar
mehere mehere is offline
Senior Sarcasm Wizardess
Click here for more information.
 
Join Date: Feb 2005
Location: Dreamland
Posts: 12,645 mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)  Folding Points: 10976 Folding Title: Novice Folder
Time spent in forums: 4 Months 3 Weeks 5 Days 18 h 58 m 26 sec
Reputation Power: 1542
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

Reply With Quote
  #5  
Old May 9th, 2008, 08:29 AM
mehere's Avatar
mehere mehere is offline
Senior Sarcasm Wizardess
Click here for more information.
 
Join Date: Feb 2005
Location: Dreamland
Posts: 12,645 mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)  Folding Points: 10976 Folding Title: Novice Folder
Time spent in forums: 4 Months 3 Weeks 5 Days 18 h 58 m 26 sec
Reputation Power: 1542
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:
Original - css Code
  1. pre {
  2.  white-space: pre-wrap;       /* css-3 */
  3.  white-space: -moz-pre-wrap !important;  /* Mozilla, since 1999 */
  4.  white-space: -pre-wrap;      /* Opera 4-6 */
  5.  white-space: -o-pre-wrap;    /* Opera 7 */
  6.  word-wrap: break-word;       /* Internet Explorer 5.5+ */
  7. }

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>

Reply With Quote
  #6  
Old May 9th, 2008, 08:31 AM
foreverforever foreverforever is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 16 foreverforever User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 h 26 m 9 sec
Reputation Power: 0
That works fine.

I've spent ages trying to work out how to do it. If only I knew then . . .

Thanks very much.

Reply With Quote
  #7  
Old May 9th, 2008, 08:39 AM
mehere's Avatar
mehere mehere is offline
Senior Sarcasm Wizardess
Click here for more information.
 
Join Date: Feb 2005
Location: Dreamland
Posts: 12,645 mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)  Folding Points: 10976 Folding Title: Novice Folder
Time spent in forums: 4 Months 3 Weeks 5 Days 18 h 58 m 26 sec
Reputation Power: 1542
np ... glad it's working for you.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > Database - Recordset - Split VeryLongWords To Prevent Table Stretching


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway