Jayson

Jayson

  • NA
  • 7
  • 0

RegisterStartupScript Problem

Dec 20 2007 3:56 PM

I'm trying to run a javascript function in my C# code behind.  I just want to pop up a new window based on the  htmlPath argument that I am giving the C# method.  I've looked all over and this is what I came up with and I still can't get it to work?  Any ideas? Thanks!

Here's the code:

public virtual void PrintPreviewLabels(string htmlPath)

{

if (!this.ClientScript.IsStartupScriptRegistered("Startup"))

{

String scriptString = "<script language=\"javascript\">";

scriptString += "window.open('+htmlPath+','Preview Labels','toolbar=no,status=no,menubar=no,location=center,scrollbars=no,resizable=no,height=500,width=350');<";//opens the pop up

scriptString += "/";

scriptString += "script>";

this.ClientScript.RegisterStartupScript(this.GetType(), "Startup", scriptString);

}

}


Answers (3)