Today in Engineer's World, we are discussing ASP.NET & C# query faced by a developer in very easy way. Posted By- +Manish Kumar Gautam +LIVE VIAR +ASP.NET SOLUTIONS
HOW TO OPEN WEBFORM IN NEW TAB OR WINDOW IN ASP.NET
Page navigation is a way by which we navigate a user
from one webform to another webform.
There
are two values by which we can target to open a webform in a different tab or
window using target property.
1.
When target=”_blank”
2.
When target=”_new”
This
target property will tell the browser
to open the webform in new window without opening new browser window.
Practical Implementation:
Source code for navigationTechnique.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="navigationTechnique.aspx.cs" Inherits="navigationTechnique" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1><u>Navigation Technique</u></h1>
<br />
<a href="webform2.aspx" target="_blank">Click here to Redirect to Webform 2 using
target value as blank</a><br />
<a href="webform2.aspx" target="_new">Click here to Redirect to Webform 2 using
target value as new</a>
</div>
</form>
</body>
</html>
Source code for
webform2.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="webform2.aspx.cs" Inherits="webform2" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h3>This is Webform 2</h3>
</div>
</form>
</body>
</html>
Output:
For any query, comment us below.
Related
Questions: -
Q-1 What is the default
value of target property?
A) _blank
B) _new
C) _parent
D) _self
E) _top
Ans. Option(D).
Explanation: target=”_self”. Opens the linked
document in the same frame as it was clicked (this is default)
Q-2 Match the following.
A) _blank (1) Opens the linked document in the
parent frame
B)
_self (2) Opens the linked
document in the same frame as it was clicked (this is default)
C) _parent (3) Opens the linked document in a new
window or tab
D) _top (4) Opens the linked document in the
full body of the window
Ans. A-3, B-2, C-1, D-4.
Keep learning and sharing…
Thanks very interesting blog!
ReplyDeleteYou hɑve brought up a νery excellent pоints, apprecіate it for
ReplyDeletethе post.
As soon as I noticed thiѕ web site I ԝent ᧐n reddit to share
ReplyDeletesome of tһe love with thеm.
Ꮩery intеresting details you һave mentioned, tһanks fⲟr posting.
ReplyDeleteThere is certainly a lot to find out about this topic. I like all of the
ReplyDeletepoints you have made.
Great post.
ReplyDeleteRemarkable! Its really remarkable article, I have got
ReplyDeletemuch clear idea about from this article.