I want to set target =_blank
to the following code, so that the Test.aspx page open in new window.
Response.Redirect("Test.aspx?D1=" + TextBox1.Text + "&D2=" + TextBox2.Text);
How can I do that?
I want to set target =_blank
to the following code, so that the Test.aspx page open in new window.
Response.Redirect("Test.aspx?D1=" + TextBox1.Text + "&D2=" + TextBox2.Text);
How can I do that?
try to add this to your object:
OnClientClick="aspnetForm.target ='_blank';"
or put it in ASP.NET like here:
<asp:LinkButton ID="myButton" runat="server" Text="Click Me!"
OnClick="myButton_Click"
OnClientClick="aspnetForm.target ='_blank';"/>
like in here
The other part you need to add is to fix the form's target otherwise every link will open in a new window. To do so add the following in the header of your POPUP window.
<script type="text/javascript">
function fixform() {
if (opener.document.getElementById("aspnetForm").target != "_blank") return;
opener.document.getElementById("aspnetForm").target = "";
opener.document.getElementById("aspnetForm").action = opener.location.href;
}
</script>
and then add:
<body onload="fixform()">