Bunch's Blog

  Home  |   Contact  |   Syndication    |   Login
  48 Posts | 0 Stories | 36 Comments | 0 Trackbacks

News

Tag Cloud


Archives

Green

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

Feedback

# re: JavaScript: Hurdling the ScriptManager 7/6/2009 6:48 PM Hema
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

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: