views:

3850

answers:

2

Hi!

Is it possible to use asp:LinkButton without JavaScript to open new windows? Currently i have workable next code, but with JS.

<asp:LinkButton ID="lnkPcName" runat="server" OnClientClick="window.document.forms[0].target='_blank';" PostBackUrl='<%# Eval("ComputerId", "ComputerInfo.aspx?ComputerId={0}") %>'><%# Eval("pcName") %></asp:LinkButton>
+5  A: 

As i know linkbuttons were originally designed to do a postback to the same page

If i were you i would use a hyperlink control instead

Issa Qandil
Yeah! Thanks guru! :PI replaced it with<asp:HyperLink ID="lnkPcName" runat="server" Target="_blank" NavigateUrl='<%# Eval("ComputerId", "ComputerInfo.aspx?ComputerId={0}") %>'><%# Eval("pcName") %></asp:HyperLink>And no more JavaScript error!!!!
Juri Bogdanov
My pleasure, And that's the right way of doing it ;)
Issa Qandil
A: 

thank you this works perfectly..this is the perfect solution to the problem

sameer