0

I am trying to open web form in new tab on button click which is not working. I have used exact same code for Website which is working fine but when same code I am using for Web Application it is not opening in new tab neither it is showing any error. Where I am going wrong please help. Below is my code

JavaScript

function NewForm() {
        document.forms[0].target = "_blank";
        $find("behaveDnr").hide();
        $find("behaveHost").hide();
        $find("behaveAnti").hide();
        $find("behaveWeb").hide();
        $find("behaveSql").hide();
        return true;
    }

My Button

<asp:Button ID="btnEdit" runat="server" Text="Edit" CssClass="closebutton" Style="text-align: center" OnClick="btnEdit_Click" OnClientClick="return NewForm();" />

Code Behind

protected void btnEdit_Click(object sender, EventArgs e)
    {
        if (Check == 1)
        {
            Response.Redirect("View-Edit-Contact.aspx?UserId=" + ViewState["DnrUserId"]);
        }
        else if (Check == 2)
        {
            Response.Redirect("Edit-Domain.aspx?CustomerId=" + ViewState["CustomerId"] + "&" + "DomainName=" + ViewState["DomainName"] + "&" + "Check=" + "1");
        }
    }
Naved Ansari
  • 650
  • 2
  • 13
  • 31
  • 1
    possible duplicate: http://stackoverflow.com/questions/10493901/how-to-open-a-page-in-new-tab-on-button-click-in-asp-net – Danscho May 20 '16 at 07:08
  • @Danscho my above code is working perfectly fine in website. But not working in web application so want to know why this is happening – Naved Ansari May 20 '16 at 07:10

0 Answers0