views:

598

answers:

1

Hi,

Does anybody know how using AutoCompleteExtender (from AJAX Control Toolkit) prevent user from entering anything not in suggested values?

+1  A: 

First, check if you would rather use the new AjaxToolKit ComboBox.

If you can't (for example, if you're using .NET Framework 2.0), you can manipulate the AutoComplete to answer your demands but it's a headache and not really what the control was made to.

The checks are supposed to be made inside the javascript, you add an event to catch OnItemSelected. And then create a function:

 function OnItemSelected (sender, e)
 {
 -- validate here
 }

Another option is to require user to choose value from list by manipulating the events: onchange, onclick & onblur. But it takes some time to find just right combination.

To lift your spirits I'll tell you that it is possible (we've done it, but I can't attach our code because of copyright issues).

Faruz
Sorry for changing the topic a little but can ComboBox be configured to load matches from codebehind when next letter is pressed?
Sergej Andrejev
I believe it will require some manipulations.http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ComboBox/ComboBox.aspx
Faruz