Re: How do we get the value from the hidden field ?
- From: "Patrice" <http://www.chez.com/scribe/>
- Date: Wed, 18 Jul 2007 15:57:11 +0200
Data are posted to a page. So you post data to this page and then you tell
the browser to direct to another page loosing previously posted data.
You have several approach :
- store this at some other location (for example in a DB, session variable,
querystring, cookies etc.. where you'll be able to read on the next page)
- use transfer rather than redirect. You have an option that preserve posted
values but the URL change won't be seen by the browser
- post directly to the next page
- post to the same page and display a different "view"
- and probably others...
Also the hidden field is not terribly usefull as basically you don't use it
(it creates an hidden field not used in the first page, then you fill this
hidden field but as you won't create HTML as you redirectn, it is basically
not used).
The key point is that data coming with the HTTP request are to be used
during the same HTTP requests. If you want to use them during later HTTP
requests you have to save them somewhere.
--
Patrice
"bienwell" <bienwell@xxxxxxxxxxx> a écrit dans le message de news:
uIrvFiTyHHA.4300@xxxxxxxxxxxxxxxxxxxxxxx
Hi,
The problem was not client -side or server side. I followed the
instruction in this forum. This code worked fine in server-side. You can
have this line
Response.Write("<BR>Hidden Value==> " & myHiddenField.Value)
instead of
Response.Redirect("RequestForm.aspx")
in the first page to see the assignment worked fine.
My problem is how to get the value from the hidden field in the second
page by suing Request.Form("myHiddenField.") ?
"Mark Rae [MVP]" <mark@xxxxxxxxxxxxxxxxx> wrote in message
news:%233yhicTyHHA.4276@xxxxxxxxxxxxxxxxxxxxxxx
"bienwell" <bienwell@xxxxxxxxxxx> wrote in message
news:%231T4IUTyHHA.5024@xxxxxxxxxxxxxxxxxxxxxxx
When I click on the button, the text field would assign the value to the
hidden field
This needs to be done client-side - it can't be done server-side...
Me.myHiddenField.Value = TextBox1.Text
Remove that line.
<asp:Button ID="btnProceed" runat="server" OnClick="btnProceed_Click"
Text="Proceed" />
<asp:Button ID="btnProceed" runat="server" OnClick="btnProceed_Click"
OnClientClick="document.getElementById('<%=myHiddenField.ClientID%>').value=document.getElementById('<%=TextBox1.ClientID%>').value;"
Text="Proceed" />
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
.
- Follow-Ups:
- Re: How do we get the value from the hidden field ?
- From: bienwell
- Re: How do we get the value from the hidden field ?
- References:
- How do we get the value from the hidden field ?
- From: bienwell
- Re: How do we get the value from the hidden field ?
- From: Mark Rae [MVP]
- Re: How do we get the value from the hidden field ?
- From: bienwell
- How do we get the value from the hidden field ?
- Prev by Date: Resending: Problems trying to build basic web service with client for testing
- Next by Date: Re: Are there any issues with installing PHP along with ASP.NET?
- Previous by thread: Re: How do we get the value from the hidden field ?
- Next by thread: Re: How do we get the value from the hidden field ?
- Index(es):