Reputation: 1327
Basically I have a inside a grid and when the user clicks on this button I want it to open a new tab on the same browser. I have tried everything and I feel like pulling my hair out on this.
Any ideas on how to approach this?
Upvotes: 1
Views: 7542
Reputation: 1
Please Try This code. It works Perfectly..
Response.Write("window.open('YourPageName.aspx','_blank');");
Upvotes: 0
Reputation: 324
Try using ScriptManager.RegisterStartupScript(Page, typeof(Page), "newwindow", "window.open('MyPage.aspx?querystring=" + parameter.ToString() + "');",true);
Upvotes: 1
Reputation: 934
You can style a link
as a button in css.
The html code could look like this :
<a href="" target="_blank">Open</a>
Explanation:
target="_blank"
- this will tell the browser to open your link in a new tab.
Upvotes: 0
Reputation: 33149
Generate the following HTML code for your button:
<button onclick="window.open('http://www.url.com')">Open</button>
Whether that will open a new tab or a new window depends on the user's browser settings -- this is not something you can control.
Upvotes: 0