I have a page that has a linkbutton that opens a report. On this linkbutton if have OnClientClick="aspnetForm.target ='_blank';" so the report opens in a new window/tab. This works as expected. I also have a regular button.
If the linkbutton is clicked first the second button also opens a new window when clicked. How do I stop this from happening?
I don't really know how to phrase the question properly so feel free to edit the question.
Your code for clientClick on LinkButton modifies the whole form target. You can probably just add
to the second (regular) button. This will again reassign form target - this time to 'self'.
The issue is you're reassigning the value of
aspnetForm.target when you click the first button. Instead of this approach, why not use
OnClientClick="void(window.open('http://www.google.com')); return false;"
can you please try to render an HTML anchor(instead of asp:linkbutton) with href set to appropriate url and set the target attribute to _blank
<a href="urlOfThePage" target="_blank" >Click me</a>