How to launch another aspx web page upon button click?
This button post to the current page while at the same time opens OtherPage.aspx
in a new browser window. I think this is what you mean with ...the original page and the newly launched page should both be launched.
<asp:Button ID="myBtn" runat="server" Text="Click me" onclick="myBtn_Click" OnClientClick="window.open('OtherPage.aspx', 'OtherPage');" />
Edited and fixed (thanks to Shredder)
If you mean you want to open a new tab, try the below:
protected void Page_Load(object sender, EventArgs e){ this.Form.Target = "_blank";}protected void Button1_Click(object sender, EventArgs e){ Response.Redirect("Otherpage.aspx");}
This will keep the original page to stay open and cause the redirects on the current page to affect the new tab only.
-J
If you'd like to use Code Behind, may I suggest the following solution for an asp:button -
ASPX Page
<asp:Button ID="btnRecover" runat="server" Text="Recover" OnClick="btnRecover_Click" />
Code Behind
protected void btnRecover_Click(object sender, EventArgs e) { var recoveryId = Guid.Parse(lbRecovery.SelectedValue); var url = string.Format("{0}?RecoveryId={1}", @"../Recovery.aspx", vehicleId); // Response.Redirect(url); // Old way Response.Write("<script> window.open( '" + url + "','_blank' ); </script>"); Response.End(); }