Asp.Net News
Free Tech Magazines
Asp.Net Web Hosting
Suggest Us
Link to Us
Feeds Subscription
Questions & Answers
Tips & Tricks
 AutoComplete Textbox limit
Posted by cyrille masson on  8/12/2008 7:52:13 AM Category: AJAX
Add to my favorites
Email to friend
How can I limit the values entered in my textBox associated with an AJAX AutoCompleteExtender 1.0 ?
I explain myself : my AutoCompleteExtender retrieve values from the Database, and I don't want the user is able to write any other values.
Exemple :
my AutoCompleteExtender retrieve these datas : "ABCDTOTO" "ABCDTITI" and "ABCDTATA"
I don't want the textbox to contain a value which isn't in theses values.

Post Your Reply Post New Question

 Viewer's Reply
RE: AutoComplete Textbox limit
Answered By Moderator1 on 8/12/2008 9:26:36 AM

I dont think so, you can do this.. If the user types a word which is not in the database, then it will not get populated in the AutoComplete Extender. So you just validate whether the value they type is exists in your database or not.

Try this.
I have found
Answered By cyrille masson on 8/13/2008 2:23:54 AM
On my validation button I put the code to verify is the data inserted into the Textbox is contained in the table asked in my autocompletion code.

if (this.CheckValue().Contains(this.Textbox1.Text)) //OK
else //KO

where CheckValue return a StringCollection filled with the names in the table in the database.
Post Your Reply If you still have problem, post it again under this reply for better response.

Sponsored by
When Good HTML Goes Bad: How You Can Protect Your Web Applications
The Beginner's Guide to Joomla