Click here to Skip to main content
15,892,253 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:
C#
string Url = "myurl";
ScriptManager.RegisterClientScriptBlock(
              UpdatePanel1,
              UpdatePanel1.GetType(),
              "window.open",
              string.Format("window.open('{0}');", Url),
              true);

I also used:
C#
Response.Write("script type='text/javascript'>window.open('" + Url + "','_blank');/script>");

please help me
thax for Advance
Posted
Updated 4-Feb-13 0:08am
v2

Try this


ScriptManager.RegisterClientScriptBlock(this, GetType(), "popup", "window.open('http://www.google.com');", true);
 
Share this answer
 
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.
 
Share this answer
 
C#
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[^]
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900