What is the best to know if user change a textbox?

  • Thread starter Thread starter rockdale
  • Start date Start date
R

rockdale

Hi,

I have a edit interface with textbox, checkbox groups ..etc, users can
edit /check/uncheck these controls, these edit controls are seperate to
different zones, and there has one save button only. in the backend I
want to know which zone is changed so that I can update its respected
table. I am think using Javascript on client side - onblur, onclick
etc to set a flag on my hidden label, but this requires me to pass in
thje lable client id to every onblur functions. Is there a better to
know whether the user changed certain textbox/checkbox? I do not want
to compare to original value on database side and then do the updates.

Thanks
rockdale
 
YesHi,
I have a edit interface with textbox, checkbox groups ..etc, users can
edit /check/uncheck these controls, these edit controls are seperate to
different zones, and there has one save button only. in the backend I
want to know which zone is changed so that I can update its respected
table. I am think using Javascript on client side - onblur, onclick
etc to set a flag on my hidden label, but this requires me to pass in
thje lable client id to every onblur functions. Is there a better to
know whether the user changed certain textbox/checkbox? I do not want
to compare to original value on database side and then do the updates.

how about adding the original value to ViewState? You could then read it
and compare it after the page posts back. If required, encrypt the stuff so
nobody can tamper with it.

Cheers,
Olaf
 
Hi,

Olaf said:
how about adding the original value to ViewState? You could then read it
and compare it after the page posts back. If required, encrypt the stuff so
nobody can tamper with it.

FWIW regarding ViewState vs. client-side tampering - there's two basic
approaches - hashing and encryption. With hashing you can have ASP.Net
automatically reject pages that return a tampered ViewState-contents.
Howver, it will still be viewable (meaning, a user has ways of seeing a
readable version of a page's ViewState). There's two ways of enabling
hashing for pages - for all pages of your app in general (include a <pages
enableViewStateMac="true"/> statement in your web.config), or for a given
page (include a <% Page EnableViewStateMAC="true" %>). Note that the latter
won't have any effect if you opt to disable this setting in your
web.config.
Regarding encryption, you again have the option of dealing with this for
the application as a whole (create a <pages
viewStateEncryptionMode="Always"/> statement in your web.config) or
explicitly for a given page (include a <% Page
ViewStateEncryptionMode="Always" %>). De-/encrypting your data will impose
a performance-penalty though, so I would be using this only where
appropriate.

Cheers,
Olaf
 
Back
Top