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 = "3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsForums
Top experts
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Blocked AccountRank #403 · 6.2K reputationPosted Dec 20, 2007, 10:48 PM EST
Hi,
Use Like this.
if (!this.ClientScript.IsStartupScriptRegistered("Startup"))
{
string scriptString = "";
this.ClientScript.RegisterStartupScript(this.GetType(), "Startup", scriptString);
}
Happy Coding!!
Jayson9 reputationPosted Dec 21, 2007, 6:11 AM EST
Posted Dec 21, 2007, 6:45 AM EST
if (!this.ClientScript.IsStartupScriptRegistered("Startup"))
{
StringBuilder scriptSb = new StringBuilder();
scriptSb.Append("");
this.ClientScript.RegisterStartupScript(this.GetType(), "Startup", scriptSb.ToString());
}