J
jupitermoonbeam
Hi,
I wondered if anyone can help. I have scowered the web and found
absolutely nothing that relates to my particular problem and I am
pulling my hair out.
Basically, I have a scenario where I need to retrieve the previous
value of a control (a text box) from the ViewState and compare it
directly with the new value. I know there is the OnChange events etc.
etc. but for this particular scenario the OnChange event doesn't always
fire.
Basically I need to keep a track of changes over several posts to
determine wether a change is a hard change or a soft change. This is
difficult to explain but has to do with a form which has an onChange
event which may, through it's actions nuke the change.
Here's an example:
I have a drop down which when changed updates another field. If they
hit the drop FIRST I need the field to change. The problem is that
someone could change the original field first, then click the drop
down, in this instance I need to preserve their values. Now to make it
more complex it all depends on the original values as to wether they
should be overwritten or not (as some options change the state more
dramatically).
The solution to this is to read from the viewstate and interogate it
for the original value of the controls. So basically what I want to do
is:
string controlOriginalValue = ViewState["Control.Text"]
string controlsNewValue = Control.Text
Can anyone help? Whenever I try to interrogate the ViewState for my
control it always has a count of 0. I have set EnableViewState to True
but still nothing is happening.
I am using ASP.NET 2.0.
I wondered if anyone can help. I have scowered the web and found
absolutely nothing that relates to my particular problem and I am
pulling my hair out.
Basically, I have a scenario where I need to retrieve the previous
value of a control (a text box) from the ViewState and compare it
directly with the new value. I know there is the OnChange events etc.
etc. but for this particular scenario the OnChange event doesn't always
fire.
Basically I need to keep a track of changes over several posts to
determine wether a change is a hard change or a soft change. This is
difficult to explain but has to do with a form which has an onChange
event which may, through it's actions nuke the change.
Here's an example:
I have a drop down which when changed updates another field. If they
hit the drop FIRST I need the field to change. The problem is that
someone could change the original field first, then click the drop
down, in this instance I need to preserve their values. Now to make it
more complex it all depends on the original values as to wether they
should be overwritten or not (as some options change the state more
dramatically).
The solution to this is to read from the viewstate and interogate it
for the original value of the controls. So basically what I want to do
is:
string controlOriginalValue = ViewState["Control.Text"]
string controlsNewValue = Control.Text
Can anyone help? Whenever I try to interrogate the ViewState for my
control it always has a count of 0. I have set EnableViewState to True
but still nothing is happening.
I am using ASP.NET 2.0.