System.Web.UI.ActiveControls.TActiveCustomValidator API Reference
Performs custom validation using only server-side OnServerValidate validation event. The client- side uses callbacks to raise onServerValidate event. The ClientValidationFunction property is disabled and will throw an exception if trying to set this property.
Beware that the onServerValidate may be raised when the control to validate on the client side changes value, that is, the server validation may be called many times.
After the callback or postback, the @link onServerValidate onServerValidate is raised once more. The IsCallback property of the TPage class will be true when validation is made during a callback request.
Chapter 12
Active Control Overview
12.1
Active Controls (AJAX enabled Controls)
See the Introduction for a quick overview of the concept behind active controls (AJAX enabled controls). Most active controls have a property of ActiveControl and a sub-property ClientSide
that provides many properties to customize the controls. TheCallbackClientproperty of the TPage class provides many methods to update and alter the client-side content during a callback request. Active controls is reliant on a collection ofjavascript classes.
For a quick demo of active controls, try theTActiveButtoncontrol. See also the later part of the
Current Convertertutorial for a more indepth example. * the tutorial for this control is not completed yet.
12.1.1
Standard Active Controls
• TActiveButtonrepresents a click button on a Web page. It can be used to trigger a callback request.
• TActiveCheckBoxrepresents a checkbox on a Web page. It can be used to collect two-state user input and can trigger a callback request.
• TActiveHyperLink represents a hyperlink on a Web page. • * TActiveImagerepresents an image on a Web page.
• * TActiveImageButtonrepresents a click button that has an image as the background. It is can be used to trigger a callback request.
• * TActiveLabelrepresents a label on a Web page. The label can be customized via various CSS attributes.
• * TActiveLinkButtonrepresents a hyperlink that can perform a callback request.
• * TActivePanel represents a container for other controls on a Web page. In HTML, it is displayed as a ¡div¿ element. The panel’s contents can be replaced during a callback request. • *TActiveRadioButtonrepresents a radiobutton on a Web page. It is mainly used in a group
from which users make a choice. It can be used to perform a callback request.
• * TActiveTextBox represents a text input field on a Web page. It can collect single-line, multi-line or password text input from users. It can be used to perform a callback request. • * TCallbackOptionscallback options such as OnLoading client-side event handlers.
12.1.2
Active List Controls
• * TActiveCheckBoxListdisplays a list of checkboxes on a Web page and each checkbox can trigger a callback request.
• * TActiveDropDownList displays a dropdown list box that allows users to select a single option from a few prespecified ones. It can be used to perform a callback request.
• * TActiveListBoxdisplays a list box that allows single or multiple selection. It can be used to perform a callback request.
• * TActiveRadioButtonList is similar to TActiveCheckBoxList in every aspect except that each TActiveRadioButtonList displays a group of radiobuttons. Each radio button can per- form a callback request.
12.1. Active Controls (AJAX enabled Controls)
12.1.3
Extended Active Controls
• * TAutoCompleteextends TActiveTextBox to offer text completion suggestions. • * TCallbacka generic control that can perform callback requests.
• * TEventTriggeredCallbacktriggers a callback request based on HTML DOM events. • * TInPlaceTextBoxrepresents a label that can be edited by clicked.
• * TTimeTriggeredCallbacktriggers a callback request based on time elapsed.
• * TValueTriggeredCallbackmonitors (using a timer) an attribute of an HTML element and triggers a callback request when the attribute value changes.
12.1.4
Active Control Abilities
The following table shows the Active Controls that can trigger a callback event and whether the control will raise a PostBack event if Javascript was disabled on the client’s browser.
12.1.5
Active Control Infrastructure Classes
The following classes provide the basic infrastructure classes required to realize the active controls. • * TActiveControlAdapter tracks the viewstate values of the control and update differences
of the client-side HTML element attributes.
• *TActiveListControlAdapterallows the adapted list controls to change the selections on the client-side during a callback request.
• * TActivePageAdapterprocess the page life-cycle for callback requests. • * TBaseActiveControlcommon active control methods and options.
• *TCallbackClientScriptmethods to manipulate the client-side HTML elements, also includes methods to invoke javascript Effects on HTML elements.
• * TCallbackClientSide common client-side callback request options, and client-side event handlers.
Control Name Triggers Callback Falls back to PostBack
TActiveButton Yes Yes
TActiveCheckBox Yes Yes
TActiveCustomValidator Yes Yes
TActiveHyperLink No Yes
TActiveImage No Yes
TActiveImageButton Yes Yes
TActiveLabel No Yes
TActiveLinkButton Yes No
TActivePanel No Yes
TActiveRadioButton Yes Yes
TActiveTextBox Yes Yes
TCallbackOptions No N/A
TActiveCheckBoxList Yes Yes
TActiveDropDownList Yes Yes
TActiveListBox Yes Yes
TActiveRadioButtonList Yes Yes
TAutoComplete Yes No TCallback Yes No TEventTriggeredCallback Yes No TInPlaceTextBox Yes No TTimeTriggeredCallback Yes No TValueTriggeredCallback Yes No