Example of Data Binding in ASP.NET MVC AutoComplete Control
This sample demonstrates the different data binding supports of the AutoComplete. Type a character(s) in the AutoComplete element and the remaining characters are automatically filled based on the first matched item.
Also, provided option to enable/disable this autofill
feature in the property panel.
Remote Data
The AutoComplete loads the data either from local data sources or remote data services through the dataSource
property. It supports the data type of array
or DataManager
.
The DataManager, that act as an interface between service endpoint and AutoComplete, will require the follwoing minimal information to interact with the service endpoint properly.
DataManager->url
- Defines the service endpoint to fetch data.-
DataManager->adaptor
- Defines the adaptor option. By default,ODataAdaptor
is used for remote binding.
The adaptor is responsible for processing response and request from/to the service endpoint.
syncfusion/ej2-data
package provides some predefined adaptors that are designed to interact with particular
service endpoints. They are:
UrlAdaptor
- Use this to interact any remote services.ODataAdaptor
- Use this to interact with OData endpoints.ODataV4Adaptor
- Use this to interact with OData V4 endpoints.WebApiAdaptor
- Use this to interact with Web API created under OData standards.WebMethodAdaptor
- Use this to interact with web methods.
In this sample, the local data is bound to a collection of sports data and the remote data is bound to a collection of
customer data as an instance of DataManager
. Also, provided option to enable/disable autofill
feature in the property panel.
StartsWith
filter type is set in this sample for showcase the autofill behavior.
More information on the data binding feature configuration can be found in the documentation sectionopens in a new tab.