user979331 user979331 - 14 days ago 6
C# Question

C# Target="_blank" in a LinkButton

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?

Answer

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>
Comments