Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Cross page posting problem

Reply
Thread Tools

Cross page posting problem

 
 
vincenthkh@gmail.com
Guest
Posts: n/a
 
      06-13-2007
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cross page posting with Master page =?Utf-8?B?QXR1bCBCYWhs?= ASP .Net 8 11-24-2010 06:00 PM
Cross Page Posting using public property on previous page =?Utf-8?B?dGhlV2l6YXJkMQ==?= ASP .Net 2 04-20-2006 08:27 PM
CROSS-POSTING, OR MULTI-POSTING, OR NEITHER? Colin D Digital Photography 56 03-08-2006 08:31 PM
How do I do cross page posting from a master page? Alan Silver ASP .Net 4 01-22-2006 11:01 AM
How to handle cross-page posting problem? =?Utf-8?B?QW5kcmV3?= ASP .Net 6 12-06-2005 08:44 AM



Advertisments