• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 257
  • Last Modified:

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

0
DuskDweller
Asked:
DuskDweller
1 Solution
 
ansudhindraCommented:
try with the below code....
 
js = "<SCRIPT LANGUAGE='JavaScript'>";
js += "window.open('/stampe/frame.aspx?pfid=RULLS','','width=300, height=100');";
js += "</script>";

Open in new window

0
 
rajapandian_81Commented:
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

0
 
DuskDwellerAuthor Commented:
Thank you!
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now