Form Data Not Displaying

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

I am have trouble sending data across multiple forms but the data is either
not going through or is being lost. Can anyone help me with this problem?
Thanks in advance.

I am using Visual Web Developer 2008 Express Edition.

I have a form that was created using the 'Standard' group in the toolbox.
The controls used from the 'Standard' group are 1 TextBox and 1 Button. They
are located on the index.aspx page.

The textbox is named: txtFirstName
The button is named: Button1

I am trying to send the data from the txtFirstName textbox that is on the
index.aspx page to the 1.aspx page, and then in turn send that same data to
the 2.aspx page.

The postbackURL for Button1 is 1.aspx. The text from the txtFirstName
textbox reaches 1.aspx fine and I am able to display it on the screen.

The data is then stored in a HiddenField named hiddenFirstName on a form in
1.aspx and then sent to 2.aspx when when Button1 on the form on the 1.aspx
page is clicked.

However, the data from the hiddenFirstName HiddenField never appears or
received.

The code for the three pages is below. (They are short and simple)


Here is the code for index.asp
-----------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<br />

<br />

First Name:&nbsp;

<asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox>

<br />

<br />

<br />

<asp:Button ID="Button1" runat="server" PostBackUrl="1.aspx" Text="Button"
/>

</form>

</body>

</html>

-----------------------------------------

Here is the code for 1.asp
-----------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<br />

<%


Dim firstname As String


firstname = Request.Form("txtFirstName")


Response.Write("First Name is " & firstname & " /// ")

%>

<br />

<asp:HiddenField ID="hiddenFirstName" runat="server" value="<%firstname%>"
/>

<br />

<asp:Button ID="Button1" runat="server" PostBackUrl="2.aspx" Text="Button"
/> &nbsp;

</form>

</body>

</html>

-----------------------------------------

Here is the code for 2.asp
-----------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<%

Dim firstname As String


firstname = Request.Form("hiddenFirstName")


Response.Write(Request.Form("hiddenTripType"))

%>

</form>

</body>

</html>

-----------------------------------------
 
I am have trouble sending data across multiple forms but the data is either
not going through or is being lost. Can anyone help me with this problem?
Thanks in advance.

I am using Visual Web Developer 2008 Express Edition.

I have a form that was created using the 'Standard' group in the toolbox.
The controls used from the 'Standard' group are 1 TextBox and 1 Button. They
are located on the index.aspx page.

The textbox is named: txtFirstName
The button is named: Button1

I am trying to send the data from the txtFirstName textbox that is on the
index.aspx page to the 1.aspx page, and then in turn send that same data to
the 2.aspx page.

The postbackURL for Button1 is 1.aspx. The text from the txtFirstName
textbox reaches 1.aspx fine and I am able to display it on the screen.

The data is then stored in a HiddenField named hiddenFirstName on a form in
1.aspx and then sent to 2.aspx when when Button1 on the form on the 1.aspx
page is clicked.

However, the data from the hiddenFirstName HiddenField never appears or
received.

The code for the three pages is below. (They are short and simple)

Here is the code for index.asp
-----------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<br />

<br />

First Name:&nbsp;

<asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox>

<br />

<br />

<br />

<asp:Button ID="Button1" runat="server" PostBackUrl="1.aspx" Text="Button"
/>

</form>

</body>

</html>

-----------------------------------------

Here is the code for 1.asp
-----------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<br />

<%

Dim firstname As String

firstname = Request.Form("txtFirstName")

Response.Write("First Name is " & firstname & " /// ")

%>

<br />

<asp:HiddenField ID="hiddenFirstName" runat="server" value="<%firstname%>"
/>

<br />

<asp:Button ID="Button1" runat="server" PostBackUrl="2.aspx" Text="Button"
/> &nbsp;

</form>

</body>

</html>

-----------------------------------------

Here is the code for 2.asp
-----------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<%

Dim firstname As String

firstname = Request.Form("hiddenFirstName")

Response.Write(Request.Form("hiddenTripType"))

%>

</form>

</body>

</html>

-----------------------------------------

Because hiddenFirstName and hiddenTripType have another id. You can
simply see it in the source code of 1.aspx. I think you would need to
enumerate all POST variables in 2.aspx
 
I am have trouble sending data across multiple forms but the data is either
not going through or is being lost. Can anyone help me with this problem?
Thanks in advance.

I am using Visual Web Developer 2008 Express Edition.

I have a form that was created using the 'Standard' group in the toolbox.
The controls used from the 'Standard' group are 1 TextBox and 1 Button. They
are located on the index.aspx page.

The textbox is named: txtFirstName
The button is named: Button1

I am trying to send the data from the txtFirstName textbox that is on the
index.aspx page to the 1.aspx page, and then in turn send that same data to
the 2.aspx page.

The postbackURL for Button1 is 1.aspx. The text from the txtFirstName
textbox reaches 1.aspx fine and I am able to display it on the screen.

The data is then stored in a HiddenField named hiddenFirstName on a form in
1.aspx and then sent to 2.aspx when when Button1 on the form on the 1.aspx
page is clicked.

However, the data from the hiddenFirstName HiddenField never appears or
received.

The code for the three pages is below. (They are short and simple)

Here is the code for index.asp
-----------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<br />

<br />

First Name:&nbsp;

<asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox>

<br />

<br />

<br />

<asp:Button ID="Button1" runat="server" PostBackUrl="1.aspx" Text="Button"
/>

</form>

</body>

</html>

-----------------------------------------

Here is the code for 1.asp
-----------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<br />

<%

Dim firstname As String

firstname = Request.Form("txtFirstName")

Response.Write("First Name is " & firstname & " /// ")

%>

<br />

<asp:HiddenField ID="hiddenFirstName" runat="server" value="<%firstname%>"
/>

<br />

<asp:Button ID="Button1" runat="server" PostBackUrl="2.aspx" Text="Button"
/> &nbsp;

</form>

</body>

</html>

-----------------------------------------

Here is the code for 2.asp
-----------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<%

Dim firstname As String

firstname = Request.Form("hiddenFirstName")

Response.Write(Request.Form("hiddenTripType"))

%>

</form>

</body>

</html>

-----------------------------------------

Because hiddenFirstName and hiddenTripType have another id. You can
simply see it in the source code of 1.aspx. I think you would need to
enumerate all POST variables in 2.aspx
 
Because hiddenFirstName and hiddenTripType have another id. You can
simply see it in the source code of 1.aspx. I think you would need to
enumerate all POST variables in 2.aspx

for each item in request.form
Response.Write(request.form(item))
next
 
Because hiddenFirstName and hiddenTripType have another id. You can
simply see it in the source code of 1.aspx. I think you would need to
enumerate all POST variables in 2.aspx

for each item in request.form
Response.Write(request.form(item))
next
 
That was a mistake on the cut and paste. Even with the hiddenFirstName
matching the data does not appear or is not received.

I am have trouble sending data across multiple forms but the data is
either
not going through or is being lost. Can anyone help me with this problem?
Thanks in advance.

I am using Visual Web Developer 2008 Express Edition.

I have a form that was created using the 'Standard' group in the toolbox.
The controls used from the 'Standard' group are 1 TextBox and 1 Button.
They
are located on the index.aspx page.

The textbox is named: txtFirstName
The button is named: Button1

I am trying to send the data from the txtFirstName textbox that is on the
index.aspx page to the 1.aspx page, and then in turn send that same data
to
the 2.aspx page.

The postbackURL for Button1 is 1.aspx. The text from the txtFirstName
textbox reaches 1.aspx fine and I am able to display it on the screen.

The data is then stored in a HiddenField named hiddenFirstName on a form
in
1.aspx and then sent to 2.aspx when when Button1 on the form on the 1.aspx
page is clicked.

However, the data from the hiddenFirstName HiddenField never appears or
received.

The code for the three pages is below. (They are short and simple)

Here is the code for index.asp
-----------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<br />

<br />

First Name:&nbsp;

<asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox>

<br />

<br />

<br />

<asp:Button ID="Button1" runat="server" PostBackUrl="1.aspx" Text="Button"
/>

</form>

</body>

</html>

-----------------------------------------

Here is the code for 1.asp
-----------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<br />

<%

Dim firstname As String

firstname = Request.Form("txtFirstName")

Response.Write("First Name is " & firstname & " /// ")

%>

<br />

<asp:HiddenField ID="hiddenFirstName" runat="server" value="<%firstname%>"
/>

<br />

<asp:Button ID="Button1" runat="server" PostBackUrl="2.aspx" Text="Button"
/> &nbsp;

</form>

</body>

</html>

-----------------------------------------

Here is the code for 2.asp
-----------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<%

Dim firstname As String

firstname = Request.Form("hiddenFirstName")

Response.Write(Request.Form("hiddenTripType"))

%>

</form>

</body>

</html>

-----------------------------------------

Because hiddenFirstName and hiddenTripType have another id. You can
simply see it in the source code of 1.aspx. I think you would need to
enumerate all POST variables in 2.aspx
 
That was a mistake on the cut and paste. Even with the hiddenFirstName
matching the data does not appear or is not received.

I am have trouble sending data across multiple forms but the data is
either
not going through or is being lost. Can anyone help me with this problem?
Thanks in advance.

I am using Visual Web Developer 2008 Express Edition.

I have a form that was created using the 'Standard' group in the toolbox.
The controls used from the 'Standard' group are 1 TextBox and 1 Button.
They
are located on the index.aspx page.

The textbox is named: txtFirstName
The button is named: Button1

I am trying to send the data from the txtFirstName textbox that is on the
index.aspx page to the 1.aspx page, and then in turn send that same data
to
the 2.aspx page.

The postbackURL for Button1 is 1.aspx. The text from the txtFirstName
textbox reaches 1.aspx fine and I am able to display it on the screen.

The data is then stored in a HiddenField named hiddenFirstName on a form
in
1.aspx and then sent to 2.aspx when when Button1 on the form on the 1.aspx
page is clicked.

However, the data from the hiddenFirstName HiddenField never appears or
received.

The code for the three pages is below. (They are short and simple)

Here is the code for index.asp
-----------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<br />

<br />

First Name:&nbsp;

<asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox>

<br />

<br />

<br />

<asp:Button ID="Button1" runat="server" PostBackUrl="1.aspx" Text="Button"
/>

</form>

</body>

</html>

-----------------------------------------

Here is the code for 1.asp
-----------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<br />

<%

Dim firstname As String

firstname = Request.Form("txtFirstName")

Response.Write("First Name is " & firstname & " /// ")

%>

<br />

<asp:HiddenField ID="hiddenFirstName" runat="server" value="<%firstname%>"
/>

<br />

<asp:Button ID="Button1" runat="server" PostBackUrl="2.aspx" Text="Button"
/> &nbsp;

</form>

</body>

</html>

-----------------------------------------

Here is the code for 2.asp
-----------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<%

Dim firstname As String

firstname = Request.Form("hiddenFirstName")

Response.Write(Request.Form("hiddenTripType"))

%>

</form>

</body>

</html>

-----------------------------------------

Because hiddenFirstName and hiddenTripType have another id. You can
simply see it in the source code of 1.aspx. I think you would need to
enumerate all POST variables in 2.aspx
 
Howdy Micheal!

I usually don't suggest alternative methods for solving a problem, but in
this case I believe it may be beneficial to at least know that you have the
ability to approach the issue in a different manner.

This code will is for a page which has a HiddenField on it named
"hiddenFirstName".
When the control loads, it will check to see if there is a PreviousPage.
If there is one, it will first try to retrieve the Text value of the
"txtFirstName" TextBox.
If that control does not exist on the PreviousPage, it will attempt to find
a HiddenField named "hiddenFirstName" and get its value from there.

Protected Sub hiddenFirstName_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles hiddenFirstName.Load
If PreviousPage IsNot Nothing Then
'Attempt to recieve FirstName Value from a TextBox on the
PreviousPage named "txtFirstName".
Dim PreviousPage_txtFirstName As TextBox =
TryCast(PreviousPage.FindControl("txtFirstName"), TextBox)
If PreviousPage_txtFirstName IsNot Nothing Then
hiddenFirstName.Value = PreviousPage_txtFirstName.Text
End If
'Attempt to recieve FirstName Value from a HiddenField on the
Previous Page named "hiddenFirstName".
Dim PreviousPage_hiddenFirstName As HiddenField =
TryCast(PreviousPage.FindControl("hiddenFirstName"), HiddenField)
If PreviousPage_hiddenFirstName IsNot Nothing Then
hiddenFirstName.Value = PreviousPage_hiddenFirstName.Value
End If
End If
End Sub

Hope this helps!

William
 
Howdy Micheal!

I usually don't suggest alternative methods for solving a problem, but in
this case I believe it may be beneficial to at least know that you have the
ability to approach the issue in a different manner.

This code will is for a page which has a HiddenField on it named
"hiddenFirstName".
When the control loads, it will check to see if there is a PreviousPage.
If there is one, it will first try to retrieve the Text value of the
"txtFirstName" TextBox.
If that control does not exist on the PreviousPage, it will attempt to find
a HiddenField named "hiddenFirstName" and get its value from there.

Protected Sub hiddenFirstName_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles hiddenFirstName.Load
If PreviousPage IsNot Nothing Then
'Attempt to recieve FirstName Value from a TextBox on the
PreviousPage named "txtFirstName".
Dim PreviousPage_txtFirstName As TextBox =
TryCast(PreviousPage.FindControl("txtFirstName"), TextBox)
If PreviousPage_txtFirstName IsNot Nothing Then
hiddenFirstName.Value = PreviousPage_txtFirstName.Text
End If
'Attempt to recieve FirstName Value from a HiddenField on the
Previous Page named "hiddenFirstName".
Dim PreviousPage_hiddenFirstName As HiddenField =
TryCast(PreviousPage.FindControl("hiddenFirstName"), HiddenField)
If PreviousPage_hiddenFirstName IsNot Nothing Then
hiddenFirstName.Value = PreviousPage_hiddenFirstName.Value
End If
End If
End Sub

Hope this helps!

William
 
you never put the postback data in the hidden field on 1.asp, so it
never makes to 2.asp. you probably think the value="<%firstname%>" didi
but it doesn't. only binding expressions (<%# exp %>) are valid with
server controls (runat=server), and they are only eval'd if a bind is done.

i don't understand your coding style for web forms, have you read the docs?

-- bruce (sqlwork.com)
 
you never put the postback data in the hidden field on 1.asp, so it
never makes to 2.asp. you probably think the value="<%firstname%>" didi
but it doesn't. only binding expressions (<%# exp %>) are valid with
server controls (runat=server), and they are only eval'd if a bind is done.

i don't understand your coding style for web forms, have you read the docs?

-- bruce (sqlwork.com)
 
That was a mistake on the cut and paste. Even with the hiddenFirstName
matching the data does not appear or is not received.

It's not because of cut and paste. Please look at the answer from
Michael
Hope this helps
 
That was a mistake on the cut and paste. Even with the hiddenFirstName
matching the data does not appear or is not received.

It's not because of cut and paste. Please look at the answer from
Michael
Hope this helps
 
Back
Top