Geeks With Blogs
Bunch's Blog One day I'll have a catchy subtitle, one day

This piece of code is related to a previous post of JavaScript Window from Code Behind. The idea is the same; I needed to get some JavaScript to run from the code behind. For this example it was to open a new window. The real difference with this and the previous post is using  ScriptManager instead of ClientScript.

 

VB.Net Code

Dim strScript As String = "<script language='javascript'>"

strScript += "window.open('URL Goes Here');"

strScript += "</script>"

ScriptManager.RegisterStartupScript(Page, Me.GetType, "clientScript", strScript, False)

C#

string script = "<script language='javascript'>";
script += "window.open('URL Goes Here');";
script += "</script>";
ScriptManager.RegisterStartupScript(Page, typeof(string), "clientScript", script, false);

 

Technorati Tags: ,,

Posted on Friday, June 20, 2008 9:54 AM ASP.Net | Back to top


Comments on this post: JavaScript: Hurdling the ScriptManager

# re: JavaScript: Hurdling the ScriptManager
Requesting Gravatar...
string script = "<script language='javascript'>";
script += "window.open('URL Goes Here');";
script += "</script>";
ScriptManager.RegisterStartupScript(Page, typeof(string), "clientScript", script, false);

It is working for Mozilla Firefox Browser but not working for IE.

Please help me
Left by Hema on Jul 06, 2009 6:48 PM

Your comment:
 (will show your gravatar)


Copyright © Bunch | Powered by: GeeksWithBlogs.net