Click here to Skip to main content
12,358,418 members (30,582 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET
i want to open new browser window in asp.net but it is not abling to open new browser window. I used update panel.
My aspx code is:
string Url = "myurl";
ScriptManager.RegisterClientScriptBlock(
              UpdatePanel1,
              UpdatePanel1.GetType(),
              "window.open",
              string.Format("window.open('{0}');", Url),
              true);
I also used:
Response.Write("script type='text/javascript'>window.open('" + Url + "','_blank');/script>");
please help me
thax for Advance
Posted 3-Feb-13 23:56pm
Edited 4-Feb-13 0:08am
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Try this


ScriptManager.RegisterClientScriptBlock(this, GetType(), "popup", "window.open('http://www.google.com');", true);
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Update panel Doesn't invokes client side functions.
If u dont need update panel just remove it. or use it for the required block only.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

protected void button_Click(object sender, EventArgs e)
    {
        // open a pop up window at the center of the page.
        ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "var Mleft = (screen.width/2)-(760/2);var Mtop = (screen.height/2)-(700/2);window.open( 'your_page.aspx', null, 'height=700,width=760,status=yes,toolbar=no,scrollbars=yes,menubar=no,location=no,top=\'+Mtop+\', left=\'+Mleft+\'' );", true);
    }

Source : http://stackoverflow.com/questions/9056103/how-to-open-new-browser-window-on-button-click-event[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 4 Feb 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100