IIS ASP - Line Wrapping

This is Interesting: Free IT Magazines  
Home > Archive > IIS ASP > May 2005 > Line Wrapping





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Line Wrapping
scott

2005-05-26, 6:00 pm

Is there a way to prevent IE from forcing a line break? Below in LISTING 2,
you notice the table background image extention of '.jpg' begins a new line,
instead of staying on the same line as it's file name. Same happens with my
javascript onclick event, IE forces a line break and breaks my code. In my
asp code, you notice I'm inserting line breaks, but IE seems to do what it
wants. I should note, the below HTML results is actually 1 table of 40 or so
that asp builds as a string.

I mention that because some tables get rendered without line breaks
following the 'jpg' and javascript code. My prolem is that when IE forces
line breaks as below, the code doesn' work.

Any ideas?

LISTING 1 - CODE

ColorInfo = ColorInfo & "<table border=0
background=""images/prints/thumb_" & RS10("choiceData1") & ".jpg""
style='border:solid 1pt #000000' cellpadding=0 cellspacing=0>" & chr(13) &
chr(10)
ColorInfo = ColorInfo & "<tr><td>" & chr(13) & chr(10)
ColorInfo = ColorInfo & "<a href=""""
onclick=""javascript:PW('pop_print.asp?print=" & RS10("choiceData1") &
"',310,400);return false;"">" & chr(13) & chr(10)
ColorInfo = ColorInfo & "<img src=""images/filler.gif"" width=60
height=40 border=0></a>" & chr(13) & chr(10)
ColorInfo = ColorInfo & "</td></tr></table></tr>" & chr(13) & chr(10)
ColorInfo = ColorInfo & "<tr><td align=center><font
face=""verdana,sans-serif"" size=1>" & Replace(RS10("choiceName"),"
","<br>",1,1) & "</font></td></tr></table></td>" & chr(13) & chr(10)


LISTING 2 - RESULTS

<table border=0 background="images/prints/thumb_Abbey
..jpg" style='border:solid 1pt #000000' cellpadding=0 cellspacing=0>
<tr><td>
<a href="" onclick="javascript:PW('pop_print.asp?print=Abbey
',310,400);return false;">
<img src="images/filler.gif" width=60 height=40 border=0></a>
</td></tr></table>


Curt_C [MVP]

2005-05-26, 6:00 pm

put it in a Table Cell with NOWRAP on

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com


"scott" <sbailey@mileslumber.com> wrote in message
news:OkjSi$iYFHA.584@TK2MSFTNGP15.phx.gbl...
> Is there a way to prevent IE from forcing a line break? Below in LISTING
> 2, you notice the table background image extention of '.jpg' begins a new
> line, instead of staying on the same line as it's file name. Same happens
> with my javascript onclick event, IE forces a line break and breaks my
> code. In my asp code, you notice I'm inserting line breaks, but IE seems
> to do what it wants. I should note, the below HTML results is actually 1
> table of 40 or so that asp builds as a string.
>
> I mention that because some tables get rendered without line breaks
> following the 'jpg' and javascript code. My prolem is that when IE forces
> line breaks as below, the code doesn' work.
>
> Any ideas?
>
> LISTING 1 - CODE
>
> ColorInfo = ColorInfo & "<table border=0
> background=""images/prints/thumb_" & RS10("choiceData1") & ".jpg""
> style='border:solid 1pt #000000' cellpadding=0 cellspacing=0>" & chr(13) &
> chr(10)
> ColorInfo = ColorInfo & "<tr><td>" & chr(13) & chr(10)
> ColorInfo = ColorInfo & "<a href=""""
> onclick=""java script:PW('pop_print.asp?print=" & RS10("choiceData1") &
> "',310,400);return false;"">" & chr(13) & chr(10)
> ColorInfo = ColorInfo & "<img src=""images/filler.gif"" width=60
> height=40 border=0></a>" & chr(13) & chr(10)
> ColorInfo = ColorInfo & "</td></tr></table></tr>" & chr(13) & chr(10)
> ColorInfo = ColorInfo & "<tr><td align=center><font
> face=""verdana,sans-serif"" size=1>" & Replace(RS10("choiceName"),"
> ","<br>",1,1) & "</font></td></tr></table></td>" & chr(13) & chr(10)
>
>
> LISTING 2 - RESULTS
>
> <table border=0 background="images/prints/thumb_Abbey
> .jpg" style='border:solid 1pt #000000' cellpadding=0 cellspacing=0>
> <tr><td>
> <a href="" onclick="java script:PW('pop_print.asp?print=Abbey
> ',310,400);return false;">
> <img src="images/filler.gif" width=60 height=40 border=0></a>
> </td></tr></table>
>



scott

2005-05-26, 6:00 pm

I tried it, but as you see below, it had no effect. is there any way to
structure my below html so the NOWRAP will work for my problem? i see how it
works with regular text, but my case is a little different.

<table border=0><tr><td NOWRAP align=center>
<table border=0 background="images/prints/thumb_Abbey
..jpg" style='border:solid 1pt #000000' cellpadding=0 cellspacing=0>
<tr><td NOWRAP><a href="" onclick="java script:PW('pop_print.asp?print=Abbey
',310,400);return false;">
<img src="images/filler.gif" width=60 height=40 border=0></a>
</td></tr></table></tr>
<tr><td align=center><font face="verdana,sans-serif" size=1>Abbey<br>(AYSP)
</font></td></tr></table>


"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:uJN1cKjYFHA.228@TK2MSFTNGP12.phx.gbl...
> put it in a Table Cell with NOWRAP on
>
> --
> Curt Christianson
> Site & Scripts: http://www.Darkfalz.com
> Blog: http://blog.Darkfalz.com
>
>
> "scott" <sbailey@mileslumber.com> wrote in message
> news:OkjSi$iYFHA.584@TK2MSFTNGP15.phx.gbl...
>
>



Dave Anderson

2005-05-26, 6:00 pm

scott wrote:
> Is there a way to prevent IE from forcing a line break? Below in
> LISTING 2, you notice the table background image extention of '.jpg'
> begins a new line, instead of staying on the same line as it's file
> name...
>
> background=""images/prints/thumb_" & RS10("choiceData1") & ".jpg""
>
> <table border=0 background="images/prints/thumb_Abbey
> .jpg" style='border:solid 1pt #000000' cellpadding=0 cellspacing=0>


Are you certain the source does not contain the line break? Does this work
any better?

..." & Trim(RS10.Fields("choiceData1").Value) & ".jpg""



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.


scott

2005-05-26, 6:00 pm

no go, i tried your code. It must be the way IIS renders it. at first, i
thought it was long field values, but it does it on 5 character values or
long ones.

i know there must be a solution, but i've exhausted all means.


"Dave Anderson" <GTSPXOESSGOQ@spammotel.com> wrote in message
news:%23xjWcijYFHA.4036@tk2msftngp13.phx.gbl...
> scott wrote:
>
> Are you certain the source does not contain the line break? Does this work
> any better?
>
> ..." & Trim(RS10.Fields("choiceData1").Value) & ".jpg""
>
>
>
> --
> Dave Anderson
>
> Unsolicited commercial email will be read at a cost of $500 per message.
> Use of this email address implies consent to these terms. Please do not
> contact me directly or ask me to contact you directly for assistance. If
> your question is worth asking, it's worth posting.
>



Mark Schupp

2005-05-26, 6:00 pm

IIRC Trim will not remove linefeeds.

Try writing out Server.URLEncode(RS10.Fields("choiceData1").Value) to see if
there is something else in the data.

I use similar code to build image urls all the time with no problems.

--
--Mark Schupp


"scott" <sbailey@mileslumber.com> wrote in message
news:%23OnvoGkYFHA.1344@TK2MSFTNGP15.phx.gbl...
> no go, i tried your code. It must be the way IIS renders it. at first, i
> thought it was long field values, but it does it on 5 character values or
> long ones.
>
> i know there must be a solution, but i've exhausted all means.
>
>
> "Dave Anderson" <GTSPXOESSGOQ@spammotel.com> wrote in message
> news:%23xjWcijYFHA.4036@tk2msftngp13.phx.gbl...
>
>



scott

2005-05-26, 8:50 pm

your server encode idea produced some interesting results. it still doesn't
work, but it maintained the filename. problem is it added %0D%OA as you can
see below. It only had that effect on certain records and there was no
pattern or sequence on which ones didn't work. it effected the same records
as before.

what coud be causing those characters?

<table border=0><tr><td NOWRAP align=center>
<table border=0 background="images/prints/thumb_Abbey%0D%0A.jpg"
style='border:solid 1pt #000000;margin: 0px;' cellpadding=0 cellspacing=0>
<tr><td NOWRAP><NOBR><a href=""
onclick="java script:PW('pop_print.asp?print=Abbey
',310,400);return false;"></NOBR>
<img src="images/filler.gif" width=60 height=40 border=0></a>
</td></tr></table></tr>
<tr><td align=center><font face="verdana,sans-serif" size=1>Abbey<br>(AYSP)
</font></td></tr></table>


"Mark Schupp" <notvalid@email.net> wrote in message
news:%23$PkgakYFHA.3648@TK2MSFTNGP14.phx.gbl...
> IIRC Trim will not remove linefeeds.
>
> Try writing out Server.URLEncode(RS10.Fields("choiceData1").Value) to see
> if there is something else in the data.
>
> I use similar code to build image urls all the time with no problems.
>
> --
> --Mark Schupp
>
>
> "scott" <sbailey@mileslumber.com> wrote in message
> news:%23OnvoGkYFHA.1344@TK2MSFTNGP15.phx.gbl...
>
>



Dave Anderson

2005-05-27, 2:48 am

"scott" wrote:
> your server encode idea produced some interesting results. it
> still doesn't work, but it maintained the filename. problem is
> it added %0D%OA as you can see below. It only had that effect
> on certain records and there was no pattern or sequence on
> which ones didn't work. it effected the same records as before.
>
> what coud be causing those characters?


They are clearly in the database.



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.


Giles

2005-05-27, 2:48 am


>
> They are clearly in the database.
>

try replace (RS10.Fields("choiceData1").Value, vbcrlf, "") ?


Kyle Peterson

2005-05-27, 5:56 pm

&nbsp;

instead of just normal spaces

can cause trouble as well



"Giles" <Giles@NoSpam.com> wrote in message
news:%23sP77woYFHA.3584@TK2MSFTNGP12.phx.gbl...
>
> try replace (RS10.Fields("choiceData1").Value, vbcrlf, "") ?
>



Mark Schupp

2005-05-27, 5:56 pm

%0D%0A = CRLF
That is causing your line wrap. You will need to strip it out before
building the URL. See Giles' suggestion.
You should also have a look into your input application to see why it is
including the CRLF at the end of file names.

--
--Mark Schupp


"scott" <sbailey@mileslumber.com> wrote in message
news:%23qBh9flYFHA.1412@TK2MSFTNGP12.phx.gbl...
> your server encode idea produced some interesting results. it still
> doesn't work, but it maintained the filename. problem is it added %0D%OA
> as you can see below. It only had that effect on certain records and
> there was no pattern or sequence on which ones didn't work. it effected
> the same records as before.
>
> what coud be causing those characters?
>
> <table border=0><tr><td NOWRAP align=center>
> <table border=0 background="images/prints/thumb_Abbey%0D%0A.jpg"
> style='border:solid 1pt #000000;margin: 0px;' cellpadding=0 cellspacing=0>
> <tr><td NOWRAP><NOBR><a href=""
> onclick="java script:PW('pop_print.asp?print=Abbey
> ',310,400);return false;"></NOBR>
> <img src="images/filler.gif" width=60 height=40 border=0></a>
> </td></tr></table></tr>
> <tr><td align=center><font face="verdana,sans-serif"
> size=1>Abbey<br>(AYSP)
> </font></td></tr></table>
>
>
> "Mark Schupp" <notvalid@email.net> wrote in message
> news:%23$PkgakYFHA.3648@TK2MSFTNGP14.phx.gbl...
>
>



Dave Anderson

2005-05-27, 5:56 pm

Mark Schupp wrote:
> IIRC Trim will not remove linefeeds.


Yet another reason I like the flexibility of writing my own:

String.prototype.trim = function(){
return this.replace(/(\s*$)|(^\s*)/g,"")
}


Or the more abstracted:

String.prototype.ltrim = function(){
return this.replace(/^\s*/g,"")
}
String.prototype.rtrim = function(){
return this.replace(/\s*$/g,"")
}
String.prototype.trim = function(){
return this.ltrim().rtrim()
}

I am obviously JScript-biased.


--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.


scott

2005-05-27, 5:56 pm

I tried all solution, but none would strip out the extra space. However, big
thanks to all for identifying the problem. When I get physical access to the
db, I will manually clean the offending records. This probably happened
while someone was copy/pasting. It shall not happen again.

Thanks to all of you for saving my sanity.


"Giles" <Giles@NoSpam.com> wrote in message
news:%23sP77woYFHA.3584@TK2MSFTNGP12.phx.gbl...
>
> try replace (RS10.Fields("choiceData1").Value, vbcrlf, "") ?
>



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com