\r\n

G

Guest

hi,
the code below isn't working...

tblcel.Attributes.Add("onclick", "var frm=window.open('page1.aspx?abc=" +
"\r\nzzzaaa" +
"','_form1_','width=200,height=200,top=0,left=0,location=0, resizable=0,
scrollbars=0');frm.focus();");

without the "\r\n" it's working fine ? any idea why ?
 
G

Guest

if my class has a property that has "\r\n"-> _cls_.rem

tblcel.Attributes.Add("onclick", "var frm=window.open('page1.aspx?abc=" +
_cls_.rem +
"','_form1_','width=200,height=200,top=0,left=0,location=0, resizable=0,
scrollbars=0');frm.focus();");

still don't work...
 
L

Laurent Bugnion

Hi,
hi,
the code below isn't working...

tblcel.Attributes.Add("onclick", "var frm=window.open('page1.aspx?abc=" +
"\r\nzzzaaa" +
"','_form1_','width=200,height=200,top=0,left=0,location=0, resizable=0,
scrollbars=0');frm.focus();");

without the "\r\n" it's working fine ? any idea why ?

Because JavaScript strings, unlike HTML, cannot be placed on more than
one line. Your best choice for onclick attributes and the likes is to
use a JavaScript function to place your code in, and to call this
function from the onclick attribute.

tblcel.Attributes.Add( "onclick", "myJavaScriptFunction();");

HTH,
Laurent
 
M

marr

Oren said:
tblcel.Attributes.Add("onclick", "var frm=window.open('page1.aspx?abc=" +
"\r\nzzzaaa" +
"','_form1_','width=200,height=200,top=0,left=0,location=0, resizable=0,
scrollbars=0');frm.focus();");

"\r\n" = "%0d%0a" = server.URLEncode(chr(13))+ server.URLEncode(chr(10))

try google keywords like url encoding asp.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top