Auto complete value handler - Demonstration

The following demonstration shows two auto-complete value handlers: one that only accepts responses coming from the auto-complete service, and the other that accepts any text provided

 
The Form
The Form
Data
Validated Auto Complete Leaf
Not Validated Auto Complete Leaf
Other Leaf
XML output

        
Auto complete value handler - Description

The AutoCompleteValueHandler is a value handler written for the AjaxControlToolkit AutoComplete extender.

The value handler takes care of cloning the AutoComplete client-side extender in case the element (you can see that if you add another 'Data' element to the form - the newly created leafs will have working auto complete functionality).

The Extender property.

To define the AutoComplete extender behavior, the Extender property should be changed.

More about the AutoCompleteExtender can be found here

The AcceptResponsesOnly property.

The AutoComplete functionality can be used in two different situations

  • 1) As a convenient substitution of a dropdown list
  • 2) As a text box with hints

In the first situation values other than those suggested by the auto complete extender should not be accepted. Besides, in such a situation the text in the control and the value that it keeps do not necessarily need to be the same.

In the second situation values suggested by the extender can only be treated as hints and are not obligatory. In such a case the text in the control is the actual value.

The AutoCompleteValueHandler can handle both situations. The validating behavior can be achieved by setting the value handler's AcceptResponsesOnlyproperty to true. The hinting behavior will work when the AcceptResponsesOnly property is set to false (it is the default value).