Ajax autocomplete extender example in asp.net without webservice
In this topic we are going to see Ajax autocomplete extender example in asp.net without webservice .
The AutoCompleteExtender control enables you to help end users find what they might be looking for when they need to type in search terms within a textbox. This feature, used on a lot of search sites today, helps in that when you start typing characters in the textbox, you get results from a datastore as a drop-down list directly below the textbox you are working with that match what you have typed so far.
To establish something similar for yourself, create a new page that contains only a ScriptManager control, an AutoCompleteExtender control, and a TextBox control. The ASP.NET portion of the page should appear as presented in below mark up.
Like the other ASP.NET AJAX controls, you extend the TextBox control using the TargetControlID property.
create a Names database and a table. Execute the following sql statements in MS sql server.
Add the following code inside the code file.
When you run this page and type the characters "a" into the textbox, the GetNames() method is called, passing in this characters. These characters are retrievable through the prefixText parameter (you can also use the count parameter, which is defaulted at 10). The Names database is called using the prefixText value and this is what is returned back to the TextBox1 control. In the end, you get a drop down list of the items that match the first three characters that were entered into the textbox.
It is good to know that the results, once called the first time, are cached. This caching is controlled via the EnableCaching property (it is defaulted to true). You can also change the style of the drop-down autocomplete list, configure how many elements appear, and much more with this feature.
.cs
0 comments:
Post a Comment