Cross page posting problem

Discussion in 'ASP .Net Web Controls' started by vincenthkh@gmail.com, Jun 13, 2007.

  1. Guest

    I have a simple page (testForm1a.aspx) with master page. I use
    PostBackUrl on the button and send the form to second page
    (testForm2.aspx). However, it seems can't get the data.
    The following is the code.

    (testForm1a.aspx)
    --------------------------
    <%@ Page Language="VB" MasterPageFile="~/masterPage1.master"
    AutoEventWireup="false" CodeFile="testForm1a.aspx.vb"
    Inherits="testForm1a" title="Untitled Page" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="contentScript"
    Runat="Server">
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
    Runat="Server">
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="Button"
    PostBackUrl="~/testForm2.aspx"/>
    </asp:Content>

    Then I want to show the TextBox1 text on second page. However, it can
    find the control.
    (testForm2.aspx.vb)
    ------------------------------
    Partial Class testForm2
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles Me.Load
    If Not IsNothing(Me.PreviousPage) Then
    Dim textbox1 As TextBox
    textbox1 = CType(Me.PreviousPage.FindControl("TextBox1"),
    TextBox)
    If IsNothing(textbox1) Then
    Response.Write("textbox not found" & "<br>")
    Else
    Response.Write("textbox: " & textbox1.Text)
    End If
    End If
    End Sub
    End Class

    Do anyone have suggestion?
    Thanks.
    Vincent
     
    , Jun 13, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. WertmanTheMad

    Cross Page Posting in .Net 2.0

    WertmanTheMad, Sep 28, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    439
    WertmanTheMad
    Sep 28, 2004
  2. =?Utf-8?B?QXR1bCBCYWhs?=

    Cross page posting with Master page

    =?Utf-8?B?QXR1bCBCYWhs?=, Jul 25, 2005, in forum: ASP .Net
    Replies:
    8
    Views:
    10,687
    mohanhegde
    Nov 24, 2010
  3. =?Utf-8?B?QW5kcmV3?=

    How to handle cross-page posting problem?

    =?Utf-8?B?QW5kcmV3?=, Dec 5, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    2,076
    Patrick.O.Ige
    Dec 6, 2005
  4. Alan Silver
    Replies:
    4
    Views:
    4,261
    Alan Silver
    Jan 22, 2006
  5. =?Utf-8?B?dGhlV2l6YXJkMQ==?=

    Cross Page Posting using public property on previous page

    =?Utf-8?B?dGhlV2l6YXJkMQ==?=, Apr 20, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    730
    Swanand Mokashi
    Apr 20, 2006
Loading...

Share This Page