Example of Data Binding in Blazor Dropdown List Component
This example demonstrates the DropDownList's data binding support. Select an item from the suggestion list by clicking the DropDownList component. When you first click on the remote data DropDownList, the loader icon will appear until the remote request retrieves the data from the server and displays it.
The DropDownList loads the data either from local data sources or remote data services through the DataSource property.
It supports the data type of Array
, Observable Collection
, ExpandoObject
, DynamicObject
and DataManager
.
The DataManager, that acts as an interface between the service endpoint and DropDownList will require the following 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 responses and requests from/to the service endpoint. Syncfusion.Blazor.Data package provides some predefined adaptors that are designed to interact with particular service endpoints. They are:UrlAdaptor
- Use this to interact with 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.
Below are the different types of data binding used in this sample.
- Local Data DropDownList is bound to a collection of sports data.
- Remote Data DropDownList is bound to a collection of customer data using
DataManager
. - Observable Collection DropDownList is bound to a
ObservableCollection
of colors data. - ExpandObject DropDownList is bound to the collection of vehicles data of type
ExpandObject
. - DynamicObject DropDownList is bound to the collection of customers data of type
DynamicObject
.
See also