<asp:LinkButton ID="lnkBtnPrint" runat="server" OnClick="lnkBtnPrint_OnClick" Target="_blank">
</asp:LinkButton>
I have Button. I need to open new tab with content on click.
protected void lnkBtnPrint_OnClick(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(hdnSubmissionID.Value))
{
SessionHelper.Set(SessionKey.SubmissionId, hdnSubmissionID.Value);
Response.Redirect(PublisherConfigurationManager.Navigation + "Printable_Submission_Document.aspx");
}
}
I try to apply answer from this post Opening a URL in a new tab to my case, but just get text in top-left corner like 'window.open...'.
Add _blank
to link - also doesn't help.
You are dynamically redirecting based on a triggered click. I think for this scenario, you could actually change it to set your HRef BEFORE the click, since you know your data on page load, provided that your sample code is complete.
Keep your target set the way it is and remove the onclick event from your link button. It should now open your "dynamic" target in a new window.