473,473 Members | 2,122 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Changing hidden values

I have a form that contains two hidden values, among other controls. I was wondering, if I change these values in server script and immediately do a server.transfer, do these values get updated before the page is changed?

I want to say that because the values are changed but the page is never reloaded after the change, that these changes do not take effect before the server.transfer. Please let me know if I am correct here. I think I am finally getting the hang of asp.net.

Thanks,

Jeremy Ames
Nov 18 '05 #1
3 1956
A good way to find out is by turning on debugger and inspect values.

Charlie
"Jeremy Ames" <yo******@here.com> wrote in message
news:e2**************@TK2MSFTNGP10.phx.gbl...
I have a form that contains two hidden values, among other controls. I was
wondering, if I change these values in server script and immediately do a
server.transfer, do these values get updated before the page is changed?

I want to say that because the values are changed but the page is never
reloaded after the change, that these changes do not take effect before the
server.transfer. Please let me know if I am correct here. I think I am
finally getting the hang of asp.net.

Thanks,

Jeremy Ames
Nov 18 '05 #2
When you do a Server.Transfer, the called page has access to the Querystring
and Forms collections of the original server post. The transfering page is
unloaded, so all data there will be gone. The called page is a new instance
of the new page, so you are starting a fresh Page instance.

Jeffrey Palermo
"Jeremy Ames" <yo******@here.com> wrote in message
news:e2**************@TK2MSFTNGP10.phx.gbl...
I have a form that contains two hidden values, among other controls. I was
wondering, if I change these values in server script and immediately do a
server.transfer, do these values get updated before the page is changed?

I want to say that because the values are changed but the page is never
reloaded after the change, that these changes do not take effect before the
server.transfer. Please let me know if I am correct here. I think I am
finally getting the hang of asp.net.

Thanks,

Jeremy Ames
Nov 18 '05 #3
Hi Jeremy,

It will help if you don't think of your executable code as "script" but
objects instead. ASP.Net has 2 components in every Page: The server-side
objects, and the client-side HTML. Neither of these necessarily has much to
do with the other. It's more useful to think of them sending messages to
each other. That is, the server-side objects which generate the client-side
HTML "send messages" by changing the HTML in the page. The client-side HTML
"sends messages" by posting back to the server. Stick with me, and shortly
you'll understand why I'm putting it this way.

You say that you have "a form that contains two hidden values." However,
that form has 2 components to it: The server-side objects, and the
client-side HTML. The server-side objects can certainly create hidden form
fields in the client-side HTML. However, these client-side form fields are
not necessarily connected in any way with a server-side objects. After all,
HTML is just text. You could create a client-side hidden form field by
simply writing the appropriate HTML into your Response. If that is indeed
what you did, how will the server-side objects have any notion that you
changed their values? There are no corresponding objects on the server to
which they are wired.

When you do a Server.Transfer, you are performing a purely server-side
operation. No Response is sent to the browser, and the HTML that resided in
the browser is history. You are simply transferring the HttpContext from one
Handler (Page object) to another. Only objects in memory will be
transferred. In order to transfer some client-side form value to the new
Handler, you have to either use server-side objects (such as
HtmlInputHidden) or place the values from the Request.Form Collection that
are not linked to any server-side objects INTO a server-side object, such as
a Public field or Property of the Page object. Or, you could just put the
values directly into the HttpContext. Any in-memory server-side object that
is accessible from the HttpContext after the transfer will be fine.

I hope the long explanation will help you to further get the hang of
ASP.Net. :)

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"Jeremy Ames" <yo******@here.com> wrote in message
news:e2**************@TK2MSFTNGP10.phx.gbl...
I have a form that contains two hidden values, among other controls. I was
wondering, if I change these values in server script and immediately do a
server.transfer, do these values get updated before the page is changed?

I want to say that because the values are changed but the page is never
reloaded after the change, that these changes do not take effect before the
server.transfer. Please let me know if I am correct here. I think I am
finally getting the hang of asp.net.

Thanks,

Jeremy Ames
Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Itai | last post by:
I have an aspx file named index.aspx which contains two ‘form' sections, one that has the runat=server attribute (e.g From1) and one which is a regular HTML form (e.g SignInForm). I am trying...
3
by: Jeff | last post by:
Hi I have a report with a graph on it and want to change the minimum and maximum values for the value axis when it is previewed. This can't be done by adding code in the Open event as once the...
2
by: Marcus | last post by:
Hi, I have a strange problem here... I have a simple onclick event on an ASP.NET button that does the following Javascript... document.getElementById("Button1").text = "Cancelled"; However,...
3
by: Trevor Braun | last post by:
This is the dumbest thing I've seen in ASP.NET. I'm trying to submit information from one page to another external (it's a Moneris pay page), using post method of a form that has a Master page. ...
11
by: saurabh | last post by:
Can anybody tell me how to change the value of an html control from the c#.... eg i hv one asp.net radio button control and one html hidden variable... so on page load in case the radio button is...
3
by: dcassar | last post by:
I am working on a complex server control that dynamically creates an HtmlInputHidden control that stores its value. As far as the postback process is concerned, this hidden input acts as the...
1
by: rbinington | last post by:
Hi, I am trying to write a DNN module that has the ability to insert articles into an article repository. I want the users to be able to move pages around and enter text into the FCKEditor. I...
4
by: VK | last post by:
As per discussion in the thread http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/117e4f3a30f4d1c3 I'm proposing to add new FAQ entry: ...
5
by: Geethu03 | last post by:
Hi i have a array values in hidden format <form name="form2" method="post" action="test.php"> <input type="hidden" name="date_val" value="<%= date %>"> <input type="hidden" name="name_val"...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.