Link to home
Start Free TrialLog in
Avatar of DuskDweller
DuskDwellerFlag for Italy

asked on

Calling a javascript, syntax problem.

Hi, I'm trying to open a new window injecting a javascript in my C# codebehind, actually I've managed to open the new window, but there seems to be a problem with the string that C# turns into JS, because the page is blank and gives me the error "Server error in application "/".

Here's the code, it should be simple to sort this out.
This is the C# code to create the JS string:
js = "<SCRIPT LANGUAGE=\"JavaScript\">\n";
js += "window.open(\"/stampe/frame.aspx?pfid=RULLS\", \"\", \"width=300, height=100\")";
js += "</script>";


This is the content of the js variable just before I pass it to Response.Write(js):
"<SCRIPT LANGUAGE=\"JavaScript\">\nwindow.open(\"/stampe/frame.aspx?pfid=RULLS\", \"\", \"width=300, height=100\")</script>"

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Sudhindra A N
Sudhindra A N
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

Try below code:
js = "<SCRIPT LANGUAGE=\"JavaScript\">\n";
js += "window.open(\"stampe/frame.aspx?pfid=RULLS\", \"\", \"width=300, height=100\")";
js += "</script>";

Open in new window

Avatar of DuskDweller

ASKER

Thank you!