Opening the navigate url in a new browser instead of redirecting in the same browser

I have asp:hyperlink in my webpage. Onclick I would like to open this in a new window instead of redirecting in the same browser.
Basically I would like to have the same effect as having an input button and on click calling the attached javascript function showwindow(). Please suggest how can I call this javascript function from the click of the asp:hyperlink. should I rather use any other html control . Please help thanks

<asp:HyperLink ID="hlPrintCart" NavigateUrl="/showwindow.aspx" runat="server">Print page</asp:HyperLink>      
function ShowWindow()
                        var h = 500;
                        var w = 600;        
                        PackingSlipPopUp ="showwindow.aspx","_blank","scrollbars=yes,toolbar=yes,resizable=yes,location=no,status=no,width=" + w + ",height=" + h + ",top= " + ((screen.height - h) / 5) + ",left=" + ((screen.width - w) / 2));
Who is Participating?

Improve company productivity with a Business Account.Sign Up

HainKurtConnect With a Mentor Sr. System AnalystCommented:

HainKurtSr. System AnalystCommented:
this may work too

<asp:HyperLink ID="hlPrintCart" NavigateUrl="#" onClick="ShowWindow()" runat="server">Print page</asp:HyperLink>
HainKurtSr. System AnalystCommented:

<asp:HyperLink ID="hlPrintCart" NavigateUrl="#" runat="server">Print page</asp:HyperLink>

vb code:
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to and use offer code ‘EXPERTS’ to get 10% off your first purchase.

HainKurtSr. System AnalystCommented:
or, why do you need server control for this? use simple <a> element

<a href="#" onClick="ShowWindow()">Print page</a>
Anurag AgarwalCommented:
hello TrialUser !! instaed of using everything just use this ......

<asp:HyperLink ID="hlPrintCart" NavigateUrl="/showwindow.aspx" runat="server" Target="_blank">Print page</asp:HyperLink>  

for reference look
Anurag AgarwalCommented:
no javascripts will be required in this case .............!!
SAMIR BHOGAYTAFreelancer and IT ConsultantCommented:
Hi, you have to use

HainKurtSr. System AnalystCommented:
target="_blank" is not he wants I guess:

if you look at this code"showwindow.aspx","_blank","scrollbars=yes,toolbar=yes,resizable=yes,location=no,status=no,width=" + w + ",height=" + h + ",top= " + ((screen.height - h) / 5) + ",left=" + ((screen.width - w) / 2));

he wants to open it in a NICE window, not in a new window :) this is what I get... and thats why he has that open function...
TrialUserAuthor Commented:
perfect thx
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.