PreviousPageType directive : Cross Page Posting « Page Lifecycle « ASP.NET Tutorial

ASP.NET Tutorial
1. ASP.Net Instroduction
2. Language Basics
3. ASP.net Controls
4. HTML Controls
5. Page Lifecycle
6. Response
7. Collections
8. Validation
9. Development
10. File Directory
11. Sessions
12. Cookie
13. Cache
14. Custom Controls
15. Profile
16. Configuration
17. LINQ
18. ADO.net Database
19. Data Binding
20. Ajax
21. Authentication Authorization
22. I18N
23. Mobile
24. WebPart
25. XML
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
ASP.NET Tutorial » Page Lifecycle » Cross Page Posting 
5. 7. 6. PreviousPageType directive
<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
   Public ReadOnly Property pp_TextBox1() As TextBox
       Get
           Return TextBox1
       End Get
   End Property
    
   Public ReadOnly Property myCalendar1() As Calendar
       Get
           Return Calendar1
       End Get
   End Property
    
   Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
       Label1.Text = "Hello " & TextBox1.Text & "<br />" & _
           "Date Selected: " & Calendar1.SelectedDate.ToShortDateString()
   End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>First Page</title>
</head>
<body>
    <form id="form1" runat="server">
        Enter your name:<br />
        <asp:Textbox ID="TextBox1" Runat="server"/>
        
        When do you want to fly?<br />
        <asp:Calendar ID="Calendar1" Runat="server"/>
        <br />
        <asp:Button ID="Button1" Runat="server" Text="Submit page to itself" 
         OnClick="Button1_Click" />
        <asp:Button ID="Button2" Runat="server" Text="Submit page to NextPage.aspx"
         PostBackUrl="NextPage.aspx" />
        <asp:Label ID="Label1" Runat="server"/>
    </form>
</body>
</html>

File: NextPage.aspx

<%@ Page Language="VB" %>
<%@ PreviousPageType VirtualPath="Default.aspx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<script runat="server">    
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
      If Page.IsCrossPagePostBack Then
        Label1.Text = "Hello " & PreviousPage.myTextbox1.Text & "<br />" & _
            "Date Selected: " & _
            PreviousPage.myCalendar1.SelectedDate.ToShortDateString()
      Else
            Response.Redirect("Default.aspx")
      End If
    End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Second Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:Label ID="Label1" Runat="server"/>
    </form>
</body>
</html>
5. 7. Cross Page Posting
5. 7. 1. New Cross-Page Posting
5. 7. 2. Exposing the values of the control from a Property
5. 7. 3. Page.IsCrossPagePostBack
5. 7. 4. Cross-page post (VB.net)
5. 7. 5. Page level property (VB.net)
5. 7. 6. PreviousPageType directive
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.