I have a webform with many input, checkbox, hidden, etc… elements and I am wondering if there is a best way to handle processing this. Right now I have to check every form element to make sure it has been filled out, that it is valid, and then update the db. I know there must be a better way, so I am looking for how others handle this situation. Thanks.
Wade73
The Valdiation Server Controls such as asp:RequiredFieldValidator works well enough and does client side checking as well.
Beware, it breaks down if
– You don’t actually buy into the entire architecture — i.e. if you ignore Page.IsValid, or customize until you aren’t actually using the validation patterns anymore.
– If your validation is much more complicated than a few checks
– If you don’t like how tightly this binds your UI to business logic.
Avoid the Validation Application Block— it is a very peculiar solution because it requires expressing validations in attributes, which is great fun until a validation gets complicated or involves if’s and loop’s and multiple fields.