View Single Post
  #5 (permalink)  
Old March 20th, 2009, 05:11 PM
Lee Dumond's Avatar
Lee Dumond Lee Dumond is offline
Wrox Author
Points: 4,694, Level: 28
Points: 4,694, Level: 28 Points: 4,694, Level: 28 Points: 4,694, Level: 28
Activity: 64%
Activity: 64% Activity: 64% Activity: 64%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 892
Thanks: 12
Thanked 154 Times in 153 Posts
Default

By the way, in case you are interested in how server-side validation works behind the scenes:

When the page is validated, it triggers the Validate method on all of the validation controls on the page. The Validate method is part of the IValidator implementation of BaseValidator.

The Validate method in turn calls the EvaluateIsValid method, which is an abstract method which is overridden in any control that inherits BaseValidator. The following code shows the override from the RequiredFieldValidator class:

Code:
protected override bool EvaluateIsValid()
{
    string controlValidationValue = base.GetControlValidationValue(base.ControlToValidate);
    return ((controlValidationValue == null) || !controlValidationValue.Trim().Equals(this.InitialValue.Trim()));
}
As you can see, it returns true if there is a non-null value for the control that is being validated.

Again, this is all performed on the server side and is built-in functionality.
__________________
Author of the upcoming ASP.NET 4.0 Website Programming: Problem - Design - Solution

Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}

Last edited by Lee Dumond : March 20th, 2009 at 07:58 PM.
Reply With Quote