viewstate to detect form change?

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...
 
N

Natty Gur

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
 
N

Natty Gur

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,602
Members
45,182
Latest member
BettinaPol

Latest Threads

Top