0

I have a aspx page that needs to be open in new TAB in Internet Explorer (Request from firm. They're using only IE). My problem is all I've tried open NEW WINDOW, but not Tab. Here What I've done:

protected void btnPracGr_Click(object sender, EventArgs e)
{
     ScriptManager.RegisterStartupScript(this, this.GetType(), "newPage", String.Format("window.open({0});", "'pgPracGr.aspx'"), true);
}

One more:

protected void btnPracGr_Click(object sender, EventArgs e)
    {
         ScriptManager.RegisterStartupScript(this, this.GetType(), "newTab", String.Format("window.open({0});", "'pgPracGr.aspx'"), true);
    }

One more:

<asp:LinkButton ID="btnPracGr" runat="server" OnClientClick ="document.forms[0].target = '_blank';" onclick="btnPracGr_Click">Practice Group Reports</asp:LinkButton>

One More:

protected void Page_Load(object sender, EventArgs e)
{
    btnPracGr.OnClientClick = String.Format("window.open({0});return false;", "'pgPracGr.aspx'");
}

Nothing works for me... All ways it open new window... Any help, please!

Bryuk
  • 3,295
  • 10
  • 45
  • 74
  • possible duplicate of [open page in new tab asp.net](http://stackoverflow.com/questions/11888892/open-page-in-new-tab-asp-net) – eddie_cat Aug 18 '14 at 15:30
  • Which actually leads to http://stackoverflow.com/questions/104601 – Robert Harvey Aug 18 '14 at 15:32
  • There's also http://stackoverflow.com/q/5530274 – Robert Harvey Aug 18 '14 at 15:32
  • and http://stackoverflow.com/q/22236816 – Robert Harvey Aug 18 '14 at 15:32
  • It's not a duplicate, cause All 3 question about OPEN IN NEW WINDOW. I need NEW TAB. None of links above work – Bryuk Aug 18 '14 at 15:36
  • Don't shout, if you didn't want us to recommend duplicates you should have referenced them in your question. – eddie_cat Aug 18 '14 at 15:39
  • @eddie_cat I don't think he should. He's very clear on what he needs and I can recognize the frustration one experiences when treated like an idiot by users not reading the text, only shooting out "pos.dup". It's very tiresome and bad for the morale of the site. He shouldn't shout, though - that was indeed inappropriate. Happy coding to all! – Konrad Viltersten Apr 21 '16 at 15:10

2 Answers2

3

You can't force a link to open in a new tab instead of a new window.

There's an option in IE's properties to force popups to open in new tabs instead of new window, it's under "Internet Options" > "General" > "Tabs" > "When a popup is encountered..."

Then your tests should work.

Gimly
  • 5,975
  • 3
  • 40
  • 75
0

Create a function on your aspx code, <script type="text/javascript"> function MyFunction() { var myWindow = window.open("DestinationPage.aspx", "_blank", "", false); } </script> then call it on your c# code

Control.Add("OnClick", "MyFunction()");