In this article i will explain what is
Ajax autocompleteextender? what is the syntax and properties?
AutoComplete Extender:
AutoComplete
is an ASP.NET AJAX extender that can be attached to any TextBox control, and
will associate that control with a popup panel to display words that begin with
the prefix typed into the textbox.
The
dropdown with candidate words supplied by a web service is positioned on the
bottom left of the text box.
Syntax:
<ajax:AutoCompleteExtender ID="AutoCompleteExtender1"
runat="server"
TargetControlID="TextBox1"
ServicePath="WebService.asmx" MinimumPrefixLength="1" EnableCaching="true" CompletionSetCount="1"
CompletionInterval="1000" ServiceMethod="GetCityName" OnClientPopulating="ShowProcessImage"
OnClientPopulated="HideProcessImage">
</ajax:AutoCompleteExtender>
Properties:
The textbox is linked with an AutoCompleteExtender
which is initialized with this code.
1. TargetControlID - The TextBox control where the
user types content to be automatically completed (Ex : txtCountry)
2. ServiceMethod - The
web service method to be called. The signature of this method must match the
following:
[System.Web.Script.Services.ScriptService]
public List<string> GetNames(string
prefixText)
3. ServicePath
- The
path to the web service that the extender will pull the word\sentence
completions from.
4. EnableCaching- Caching is turned on, so typing
the same prefix multiple times results in only one call to the web service.
5. MinimumPrefixLength- Minimum number of characters
that must be entered before getting suggestions from the web service.
6. CompletionInterval - Time in milliseconds when the
timer will kick in to get suggestions using the web service.
7. CompletionSetCount - Number of suggestions to be
retrieved from the web service.
8. OnClientPopulating - This one used to display
progress image in textbox during getting the data from database using web
service.
9. OnClientPopulated - This one used to hide progress
image in textbox after finishing data retrieval from database.
10. DelimiterCharacters - Specifies one or more
character(s) used to separate words. The text in the AutoComplete textbox is
tokenized using these characters and the webservice completes the last token.
11. FirstRowSelected -
Determines if the first option in the AutoComplete list will be selected by
default.
No comments:
Post a Comment