Validation Controls in ASP.NET

You might have used Validation controls in ASP.NET. There are two noteworthy enhancements to BaseValidator class from which all validation controls derive from.

1) A new property SetFocusOnError is now available, which when set to True, will automatically generate necessary JS script to set the focus to the control being validated if there is a validation failure.

2) Another property named ValidationGroup has been added. By setting a common value to a set of validation controls and to a Submit button in your Form, you can selectively fire validation events for some controls. In ASP.NET 1.x this kind of granular control over the validation process is not feasible. If you have a set of validation controls, all events would fire when the Form is attempted for submission. This new feature can be leveraged when you have two logical sets of UI elements to be validated and the user can initiate two distinct operations using two different buttons in the screen.

No comments:


Powered by Blogger.