Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Navigation methods in ASP.NET

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 272
    Comment on it

    Moving from one page to another is called navigation.
     
    There are following techniques to navigate from one page to another:-

    •   Hyperlink control
    •   Response.Redirect
    •   Server.Transfer
    •   Server.Execute
    •   Window.Open script method

     
    1.Hyperlink control- It is a simple way for navigation. It is performed using <a> tag. In this we can change the target link dynamically as we want, the target page shows the full detail about the topic/link.
     
    e.g of hyperlink control-
     

    <a href="Login.aspx">Login HERE</a>

     
    2.Response.Redirect- It shifts from code to another page by clicking on link button or image button. It is used if we want to connect to any web server or to a non-ASPX  resource.
     
    e.g of response.redirect:-
     

    protected void Page_Load(object sender, EventArgs e) { // Get response. var response = base.Response; // Redirect temporarily.
            // ... Don't throw an HttpException to terminate. response.Redirect("http://www.dotnetperls.com/list", false); }
     


    3.Server.Transfer- In Server.Transfer() method the execution of current ASPX page is terminated and move to another ASPX page. The URL of the browser will still show the name of the original page after the transfer of the page.

    e.g of Server.Transfer:-

    //Code-behind for FirstPage.aspx 
    procedure FirstPage.Button1_Click( sender: System.Object; e: System.EventArgs);
     begin Server.Transfer('SecondPage.aspx'); 
    end;

     

    4.Server.Execute- Server.Execute() method is used to implement the execution of new web page and showing the current web form. This method is used in .aspx file.

    e.g of Server.Execute:-

    response.write("page1<br>")
    Server.Execute("file2.asp")
    response.write("page2")

     

    5.Window.open method- In Window.Open method a new browser window is opened in client side.

    e.g of Window.Open method:-

    function newfunction() {
        window.open("http://www.w3schools.com");
    }

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: