Hi
I just made this bit of code to demonstrate what you are trying to achieve:
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Character Test</title>
</head>
<body>
<%
str = "[email protected]"
strmax = 15
if len(str) > strmax then
response.write("<p>" & left(str,strmax) & "<br />" & mid(str,(strmax + 1),len(str)) & "</p>")
else
response.write("<p>" & str & "</p>")
end if
%>
</body>
</html>
If you copy this into an asp file and upload it to your web server, you will be able to see it in action.
i don't know where your data source is, but for the sake of the example i just specified a random string. You may have this fed from a database etc.
As you can see i have specified a max string length just under the random string. I chose to specify the max length so changes can be made to that variable and the changes will roll out in the if statement. First of all it checks whether the length of the string exceeds the limit set, if it does, it breaks it up. It takes the first block of characters up till the strmax, then concatenates <br /> to create the line break. Then it concatenates the remainder of the string by using the mid function to read the text starting after the max limit (hence the adding of 1) characters till the string length which is the end. If the string does not exceed the max set, then it just outputs it without the <br /> through the else statement.
I hope this gives you an idea of what to do. You could go all advanced and build it into a function to call up. You could do a lot of things...
Idealy if this is a normal html table and i needed to achieve what you're doing then id simply just specify the column width in px and let the browser break it automatically!
Hope that helps mate!