viewstate to detect form change?

  • Thread starter Thread starter J. Johnson
  • Start date Start date
J

J. Johnson

Is it possible use viewstate to detect if a form's data has changed? I
want to prevent duplicate submission of data.

Example:

On_click event of Submit button:

1. Save viewstate to session.
2. Insert form data into SQL db.
3. Now suppose the user submits the same form (no changes to data). If
I compare the current viewstate to the original viewstate (stored in
session), will they be equal ?

How can I examine the viewstate during the on_click event?

Thanks...
 
hI,

Intersting ....

you can get the data from form __viewstate field :

string CurViewState = Request.Form("__viewstate ");

Natty Gur, CTO
Dao2Com Ltd.
34th Elkalay st. Raanana
Israel , 43000
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
 
In a secound thoght the viewstate holds the state of controls on the
client. i think you need to save the form data and not the viewstate.

string FormData = this.Request.Form.ToString();

Natty Gur, CTO
Dao2Com Ltd.
34th Elkalay st. Raanana
Israel , 43000
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
 
Back
Top