0

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?

SpaceApple
  • 1,309
  • 1
  • 24
  • 46

4 Answers4

1

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.

Roy Dictus
  • 32,551
  • 8
  • 60
  • 76
1

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.

alexo
  • 936
  • 8
  • 16
0

Try using ScriptManager.RegisterStartupScript(Page, typeof(Page), "newwindow", "window.open('MyPage.aspx?querystring=" + parameter.ToString() + "');",true);

Jayesh Amin
  • 314
  • 2
  • 12
0

Please Try This code. It works Perfectly..

Response.Write("window.open('YourPageName.aspx','_blank');");