469,610 Members | 1,554 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,610 developers. It's quick & easy.

Problem sending values from one page to another (pepehammer)

Hi guys, I'm using the following code to send values from one page to
another, but seems to me, that the event Page_Load in the receiving page
never fires.
Why?

This is the code:

Thanks

-*-*-*-*-*-*

PAGE SENDING THE INFORMATION
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="PageSend.aspx.vb"
Inherits="Testing.WebForm1" ClassName="classPageSend"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<!-- This is the script containig the logic to send -->
<!-- variable information from one page to another -->
<!-- THis is declared between the <HEAD> tag -->
<script language="vb" runat="server">

Public ReadOnly Property FirstName() as String
Get
Return txtFirstName.Text
End Get
End Property

Public ReadOnly Property LastName() as String
Get
Return txtLastName.Text
End Get
End Property

Sub ButtonClicked(sender As Object, e As EventArgs )
Server.Transfer("PageReceive.aspx")
End Sub

</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:textbox id="txtFirstName" style="Z-INDEX: 101; LEFT: 72px; POSITION:
absolute; TOP: 72px"
runat="server"></asp:textbox><asp:textbox id="txtLastName"
style="Z-INDEX: 102; LEFT: 72px; POSITION: absolute; TOP: 104px"
runat="server"></asp:textbox><asp:button id="btnSend" style="Z-INDEX:
103; LEFT: 72px; POSITION: absolute; TOP: 144px" onclick="ButtonClicked"
runat="server" Text="Send"></asp:button></form>
</body>
</HTML>

PAGE RECEIVING THE INFORMATION

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="PageReceive.aspx.vb" Inherits="Testing.PageReceive" %>
<%@ Reference Page="PageSend.aspx"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>PageReceive</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">

<script language="VB" runat="server">

Protected classPage as classPageSend

Sub Page_Load()

Response.Write("Say this")

If Not IsPostBack then
classPage = CType(Context.Handler, classPageSend)
lblName.Text = "aaaa" 'classPage.FirstName
Response.Write("Say that")
End if

End Sub

</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:label id="Label1" style="Z-INDEX: 101; LEFT: 24px; POSITION:
absolute; TOP: 40px" runat="server">Shows the Values</asp:label>
<asp:Label id="lblName" style="Z-INDEX: 102; LEFT: 24px; POSITION:
absolute; TOP: 56px" runat="server"></asp:Label></form>
</body>
</HTML>
Nov 18 '05 #1
2 1444
Cor
Hi Marcelo,

Paul had yesterday almost the same problem, I did send him this

You have to save your values or in "session" variables, but things like this
beter in a "viewstate".

Have a look for that.

http://msdn.microsoft.com/library/de...sp11222001.asp

If you do not find it, message again.
(But not direct)

I hope this helps?

Cor
Nov 18 '05 #2
Have you tried to set the value of AutoEventWireup from "false" to
"true".

Frank

On Thu, 22 Jan 2004 00:59:49 -0500, "Marcelo" <pe********@hotmail.com>
wrote:
Hi guys, I'm using the following code to send values from one page to
another, but seems to me, that the event Page_Load in the receiving page
never fires.
Why?

This is the code:

Thanks

-*-*-*-*-*-*

PAGE SENDING THE INFORMATION
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="PageSend.aspx.vb"
Inherits="Testing.WebForm1" ClassName="classPageSend"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<!-- This is the script containig the logic to send -->
<!-- variable information from one page to another -->
<!-- THis is declared between the <HEAD> tag -->
<script language="vb" runat="server">

Public ReadOnly Property FirstName() as String
Get
Return txtFirstName.Text
End Get
End Property

Public ReadOnly Property LastName() as String
Get
Return txtLastName.Text
End Get
End Property

Sub ButtonClicked(sender As Object, e As EventArgs )
Server.Transfer("PageReceive.aspx")
End Sub

</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:textbox id="txtFirstName" style="Z-INDEX: 101; LEFT: 72px; POSITION:
absolute; TOP: 72px"
runat="server"></asp:textbox><asp:textbox id="txtLastName"
style="Z-INDEX: 102; LEFT: 72px; POSITION: absolute; TOP: 104px"
runat="server"></asp:textbox><asp:button id="btnSend" style="Z-INDEX:
103; LEFT: 72px; POSITION: absolute; TOP: 144px" onclick="ButtonClicked"
runat="server" Text="Send"></asp:button></form>
</body>
</HTML>

PAGE RECEIVING THE INFORMATION

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="PageReceive.aspx.vb" Inherits="Testing.PageReceive" %>
<%@ Reference Page="PageSend.aspx"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>PageReceive</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">

<script language="VB" runat="server">

Protected classPage as classPageSend

Sub Page_Load()

Response.Write("Say this")

If Not IsPostBack then
classPage = CType(Context.Handler, classPageSend)
lblName.Text = "aaaa" 'classPage.FirstName
Response.Write("Say that")
End if

End Sub

</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:label id="Label1" style="Z-INDEX: 101; LEFT: 24px; POSITION:
absolute; TOP: 40px" runat="server">Shows the Values</asp:label>
<asp:Label id="lblName" style="Z-INDEX: 102; LEFT: 24px; POSITION:
absolute; TOP: 56px" runat="server"></asp:Label></form>
</body>
</HTML>


Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Dan | last post: by
11 posts views Thread by Abhishek | last post: by
5 posts views Thread by vtreddy | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.