AutoCompleteExtender automatically completes the extension. When used with TextBox, the function is similar to entering search words in Google, and a drop-down box will appear under TextBox to display the items in the search target
This extension control needs to be used in conjunction with Web Service, so it involves the use of web Service. (I will only talk about it briefly here, and then I will talk about the content of web service in detail after you are familiar with it)
First introduce several key attributes of AutoCompleteExtender:
a, TargetControlID This attribute is a common attribute of all AjaxControlToolkit, which is an extension. Target control ID (this is what the official said)
b.CompletionSetCount This attribute is to set the number of drop-down results to be displayed. The default is 10
c.MinimumPrefixTextLength This attribute is to set the length of a few characters and call the webService. The method displays a drop-down list
d.ServicePath This attribute sets the path of the web service that needs to be called
e.ServiceMethod This attribute sets the method (function) in the web service that needs to be called
f.EnableCaching: whether it is in the client Cache data on the end, the default is true
g.CompletionInterval: the time interval for reading data from the server, the default is 1000, unit: milliseconds
Note: If you are used to setting properties with visual controls, the a property is in AutoCompleteExtender After setting the TargetControlId, other properties will be set in the Extenders property in the corresponding TargetControl. If you are used to handwriting code, set it in the AutoCompleteExtender code property.
Example: 1. Create a new page, add a ScriptManager control, a TextBox control and an AutoCompleteExtender control
2. Create a new webService and add a [WebMethod] method
[WebMethod]