How to Open a webPage in new Tab or new Window in ASP.net(C#)?

Recommended Answers

All 4 Replies

<a href="yourpage.aspx" target="_blank" >Open in new Window</a>

or you can user asp.net HyperLink Control..

But what to do if I am redirecting my page on Button_click() event. How can i write this <a href> code in a button click event.

Using Javascript it is possible..

on button click you need to register your script

which will open a Modal Popup just Like a Current Window..

hope that should work...

But what to do if I am redirecting my page on Button_click() event. How can i write this <a href> code in a button click event.

Hey very simple,

function openwindow(pagename)
{
window.open(pagename,"MyWindow");
}

call this javascript on your button "onClientClick" event. Pass the page url as argument

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.