HOW TO OPEN WEBFORM IN NEW TAB OR WINDOW IN ASP.NET C#

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 

Click imagination hunt to see latest Blogs


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.

Click imagination hunt to see latest blogs

Keep learning and sharing…

Comments

Popular posts from this blog

SSC CGL 2016 Tier-1 Marks / Result

DATA TYPES IN C#

Pattern printing program

IS STRING MUTABLE OR IMMUTABLE IN .NET?

Top Mutual Funds

SSC CGL 2017 TIER 2 RESULT OUT

JUST IN TIME (JIT)

Can we have multiple Main methods in one class

TOP 15 VISUAL STUDIO SHORTCUT KEYS

Top 10 Interview Tips and Questions