B
bienwell
Hi,
I've got a problem of getting the value from the hidden field in the
previous page when I'm in the next page:
I have 2 web pages. In the first page I have a hidden field, a text field
and a button. When I click on the button, the text field would assign the
value to the hidden field, and the page redirect to the next page. In the
next page, I'd like to get the value from the hidden field from the first
page. My problem is I got the blank value from the hidden field. The code
looks like this:
1- First page:
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub btnProceed_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Me.myHiddenField.Value = TextBox1.Text
Response.Redirect("RequestForm.aspx")
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server" >
<div>
<asp:hiddenfield id="myHiddenField" runat="server"/>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
<br />
<asp:Button ID="btnProceed" runat="server" OnClick="btnProceed_Click"
Text="Proceed" /></div>
</form>
</body>
</html>
=========================================================
Second page:
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub Page_Load()
Response.Write("<BR>Value ==> " & Request.Form("myHiddenField"))
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
==========================================
Did I do something wrong ? Please advise!
Thanks in advance.
I've got a problem of getting the value from the hidden field in the
previous page when I'm in the next page:
I have 2 web pages. In the first page I have a hidden field, a text field
and a button. When I click on the button, the text field would assign the
value to the hidden field, and the page redirect to the next page. In the
next page, I'd like to get the value from the hidden field from the first
page. My problem is I got the blank value from the hidden field. The code
looks like this:
1- First page:
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub btnProceed_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Me.myHiddenField.Value = TextBox1.Text
Response.Redirect("RequestForm.aspx")
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server" >
<div>
<asp:hiddenfield id="myHiddenField" runat="server"/>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
<br />
<asp:Button ID="btnProceed" runat="server" OnClick="btnProceed_Click"
Text="Proceed" /></div>
</form>
</body>
</html>
=========================================================
Second page:
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub Page_Load()
Response.Write("<BR>Value ==> " & Request.Form("myHiddenField"))
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
==========================================
Did I do something wrong ? Please advise!
Thanks in advance.