user979331 user979331 - 10 months ago 70
C# Question

C# Target="_blank" in a LinkButton

is it possible to have a

...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?

Answer Source

Just render an anchor with href set to appropriate url and set the target attribute to _blank it will open the url into new window.

<a href="urlOfThePage" target="_blank" >Click me</a>