Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Visual Studio 2005 For discussing Visual Studio 2005. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 17th, 2004, 06:58 PM
Authorized User
 
Join Date: Aug 2004
Location: dollard des ormeaux, Quebec, Canada.
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to macupryk Send a message via Yahoo to macupryk
Default cross-page posting

I have the following two pages. I am wondering how can I return back.
When I click on the back link to go to page one I want the values to be saved or in the textboxes. What is the appropriate way in visual studio 2005?

CrossPage1.aspx
===============
<%@ Page Language="C#" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div align="center">
        <table>
            <tr>
                <td>Enter some Text:</td>
                <td><asp:TextBox ID="TextBox1" Runat="server"></asp:TextBox></td>
            </tr>
            <tr>
                <td>Enter more Text:</td>
                <td><asp:TextBox ID="TextBox2" Runat="server"></asp:TextBox></td>
            </tr>
            <tr>
                <td align="center" colspan="2">
                    <asp:LinkButton ID="LinkButton1" Runat="server" PostBackUrl="CrossPage2.aspx">Submit Page</asp:LinkButton>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>

CrossPage2.aspx
===============
<%@ Page Language="C#" %>
<%@ PreviousPageType VirtualPath="CrossPage1.aspx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<script runat="server">
    void Page_Load(object sender, System.EventArgs e)
    {
        // If posted from CrossPage1.aspx to CrossPage2.aspx...

        if (PreviousPage == null)
        {
            Response.Write("Invoke me only through cross-page posting.");
             Response.End();
             return;
        }
        else
        {
            // Retrieve the textbox values from FindControl
            TextBox TextBox1;
            TextBox TextBox2;
            TextBox1 = (TextBox)PreviousPage.FindControl("TextBox1");
            TextBox2 = (TextBox)PreviousPage.FindControl("TextBox2");
            Response.Write(TextBox1.Text+"<br>"+TextBox2.Text+ "<br>");
         }


    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Page2</title>
</head>
<body>
    <form id="form1" runat="server">
    <div align="center">
        <asp:Label ID="Label1" Runat="server" EnableViewState="False"></asp:Label>&nbsp;<br />
        <br />
        <asp:HyperLink ID="HyperLink1" Runat="server" NavigateUrl="crosspage1.aspx">Back</asp:HyperLink>
    </div>
    </form>
</body>
</html>




Knowledge is to be shared.
__________________
Knowledge is to be shared.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cross-Page Posting roman BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 1 June 25th, 2008 10:25 AM
cross-page posting within pages with master file.. poogles ASP.NET 2.0 Basics 2 August 6th, 2007 05:11 AM
Posting String Array From one page to another page Samatha ASP.NET 1.0 and 1.1 Professional 1 December 6th, 2006 03:54 AM
Page is posting to itself parypoo ASP.NET 1.0 and 1.1 Professional 2 April 17th, 2006 06:08 AM
Page Not Posting RGB ASP.NET 1.0 and 1.1 Basics 11 March 7th, 2006 01:58 PM



All times are GMT -4. The time now is 04:44 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.