is it possible to have a target="_blank"
in LinkButton
...mine doesnt seem to be working
<asp:LinkButton runat="server" ID="g31" Text="PDF"
CommandArgument='<%# DataBinder.Eval(Container.DataItem,"productID") %>'
CommandName='<%# DataBinder.Eval(Container.DataItem,"documentID") %>'
OnCommand="linkbutton_showpdf" target="_blank">
</asp:LinkButton>
Or would I have to use a different button format?
You can use like this with Link Button
Replace target="_blank"
to OnClientClick="window.document.forms[0].target='_blank';"
.
None of the current answers are correct, even the <a>
tag is not the correct answer in asp.net.
Use the HyperLink Button. There is even a property for the target attribute.
<asp:HyperLink runat="server"
NavigateUrl='http://rrs.com/aspx/Equipment/EquipmentType.aspx'
Target="_blank">
Create/Edit Part Types
</asp:HyperLink>
You can use the Hyperlink control, which does have a target='_blank'
property. However if you must use a LinkButton control, then you can add a OnClientClick
attribute which then calls a JavaScript function to open a popup window
window.open();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With