
CustomValidator | 743
MobileControls
Namespace
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Passed To
ItemPager.ItemPager( ), MobileControl.PaginateRecursive( )
CustomValidator
System.Web.UI.MobileControls (system.web.mobile.dll)
.NET 1.1, disposable
class
The CustomValidator control allows you to define your own validation routines. A similar
task could be performed by writing manual validation code in the click event for a
submit button, but using a CustomValidator allows you to create validation code that will
run any time the page is validated, and can provide a “vote” used for the MobilePage.
IsValid property along with all other validation controls. A CustomValidator can also be
easily reused to validate multiple controls.
To provide server-side validation, create an event handler for the ServerValidate event.
The string from the input control and the result of the validation is stored in the
provided System.Web.UI.WebControls.ServerValidateEventArgs object. In this way, the CompareVali-
dator works exactly the same as the System.Web.UI.WebControls.CustomValidator control, although
it doesn’t include the ability to define client-side validation logic using a JavaScript
function, because few mobile devices would support it.
Hierarchy
System.Object ➝ System.Web.UI.Control(System.ComponentModel.IComponent, System.
IDisposable, System.Web.UI.IParserAccessor, ...