Clicking on ASP.NET button redirects to correct website but on the same tab, not in a new tab what i need to do. What’s wrong with the code OnClientClick="aspnetForm.target ='_blank';" below? Why it is not enough alone and what else need to be done?
The following ASP.NET code for the button control is:
<asp:Button ID="btnGenerateReport" runat="server" Text="Generate Report"
OnClick="btnGenerate_Click" OnClientClick="aspnetForm.target ='_blank';" />
If you are looking out for server side code to open a new window on Button Click, then here’s how to do so.
Add the following script to the section of your page
Then add a Button Control in the following manner
Finally add some code in the code behind file