开发者

How to open ASP page in a new tab/window?

开发者 https://www.devze.com 2023-03-16 06:13 出处:网络
I know that the HTML anchor 开发者_如何转开发taghas an attribute called target, which will open a new page in a new window/tab if we set target=\'_blank\'. It should work well with static HTML pages.

I know that the HTML anchor 开发者_如何转开发tag has an attribute called target, which will open a new page in a new window/tab if we set target='_blank'. It should work well with static HTML pages.

However, when we submitting a form by clicking the submit button on an ASP page, I find that the result page normally will be loaded into the same tab/window.

So my question is: are we able to load page into a new tab/window when user clicks submit button?

Thanks.

EDIT: Looks like <form target='blank'> is the answer although its said to be deprecated according to w3schools website. :)


Just like a link:

<form target='_blank'>

No need to do anything on the ASP side of things. Of course, as with all pop-ups, this is subject to browser settings.


Form's target shold work.

<form target="_blank" ...></form>

From here (have you searched?)


Try this out..

Response.Redirect to new window


You have two methods for redirecting the page to new tab in asp

1) Make an onclientclick event of Button and on code behind of Button Click write the following code:-

button.OnClientClick = "aspnetForm.target='_blank'"; Response.Redirect("yourpage.aspx");

2)You can also use javascript

 button.Attributes.Add("onclick", "window.open('yourpage.aspx');return false;");

Both the method will redirect your page to new tab on clicking the button.

0

精彩评论

暂无评论...
验证码 换一张
取 消