By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,143 Members | 790 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,143 IT Pros & Developers. It's quick & easy.

Text of comments goes over boundary

100+
P: 145
I have 3 column of css on my webpage, on the webpage user can enter their comments which will be saved in database. And then the comments from database is retrieve and displayed on the webpage.

My problem is the comments is long and when displayed on the webpage it goes out of bound of the center column.I want it to go under as in paragraph How can this be solved? I think the code that retrieve and displayed the comments should be changed or the database.

Expand|Select|Wrap|Line Numbers
  1. sql2 = "SELECT * FROM Cadangan";
  2.             rs = Server.CreateObject("ADODB.Recordset");
  3.             rs.Open(sql2,Conn);
  4.  
  5.             out ="<table width="200">";
  6.  
  7.             while(!(rs.EOF))
  8.             {
  9.  
  10.                 out += "<tr><td>"
  11.                 out += rs("Cadangan") + "</td></tr>"
  12.                 out += "<tr><td>" + rs("Nama") + "</td>"
  13.                 out += "<td>" + rs("Email")
  14.                 out += "</td></tr>"
  15.  
  16.  
  17.                 rs.MoveNext();
  18.  
  19.  
  20.             }
  21.  
  22.             out += "</table>"
  23.             var line ="<hr>"
  24.             rs.Close();
  25.             Response.Write(out);
  26.  
May 26 '10 #1
Share this Question
Share on Google+
5 Replies

jhardman
Expert 2.5K+
P: 3,405
is RS("cadangan") the comments?

Jared
May 28 '10 #2

100+
P: 145
yes RS("cadangan") is the comments
Jun 1 '10 #3

jhardman
Expert 2.5K+
P: 3,405
without looking at the final, formatted page, I see two possibilities. 1- the rs("cadangan") contains HTML code that interfere with the rest of your formatting, or 2- your css code is restricting the size of the td element and allowing the content to spill out. Is it possible that #1 is happening?

Jared
Jun 2 '10 #4

100+
P: 145
i've tried delete the html code but the result is still the same and I do not define table element in css.

I try another way, i put new code in my CSS and tried do it but the result still the same. Here is the code:

CSS Code for comment:

Expand|Select|Wrap|Line Numbers
  1. div.comment.list{
  2.     float:left;
  3.     width:360px;}
  4.  
  5. .comment_body{padding-top: 4px;}
  6.  
  7. .comment_content{
  8.     padding-left:2px;
  9.     border-bottom: 1px solid #D6D6D6;
  10. }
CSS code for column:

Expand|Select|Wrap|Line Numbers
  1. #content{
  2.    width: 720px;
  3.    margin: 0 auto;
  4. }
  5.  
  6. #colOne{
  7.     float: left;
  8.     width: 160px;
  9. }
  10.  
  11. #colTwo{
  12.     float: left;
  13.     width: 360px;
  14.     padding: 0 20px;
  15. }
  16.  
  17. #colThree{
  18.     float: left;
  19.     width: 160px;
  20. }
ASP code:

Expand|Select|Wrap|Line Numbers
  1. out ="<div class='comment_list'>"; 
  2.  
  3.             while(!(rs.EOF)) 
  4.             { 
  5.  
  6.                 out += "div class='comment_body'>" + rs("Cadangan")
  7.                 out += "<p>" 
  8.                 out += "div class='comment_content'>" + rs("Nama") + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + rs("Email")
  9.                 out += "<p></div>" 
  10.  
  11.  
  12.                 rs.MoveNext(); 
  13.  
  14.  
  15.             } 
  16.  
  17.             out += "</div>" 
  18.             rs.Close(); 
  19.             Response.Write(out);
Jun 3 '10 #5

100+
P: 145
I already figure out the solution.Thanks
Jun 7 '10 #6

Post your reply

Sign in to post your reply or Sign up for a free account.