Validation control grouping has many advantages. First, it improves performance by instructing ASP.NET to perform validation on controls associated with a particular group. To accomplish this, ASP.NET 2.0 adds a ValidationGroup property to other controls that can cause postbacks such as buttons. This means that you can associate a Save button with a particular validation group. The Page class's Validate method is overloaded to accept a validation group name as an input parameter. When all of this is connected, the button instructs the page to perform server-side validation on only those controls in the specified group.
Another advantage of validation control is that it affords you the ability to restrict the information that is presented in a ValidationSummary control. Clearing the ValidationGroup property of the ValidationSummary control effectively associates the summary control with validation controls that also have a non-specified ValidationGroup property. Alternatively, specifying a value for the ValidationGroup property associates the ValidationSummary control with validation controls in the same group.
Saturday, April 26, 2008
Validation control grouping
Labels:
ASP.NET 2.0,
Validation Controls
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment