Data Binding Overview
RadAutoCompleteBox supports binding to various data sources, which include:
Databinding Properties and Methods
The following properties and methods are used when binding RadAutoCompleteBox to a data source.
DataSource property - set to an instance of your data source. This is mandatory when binding RadAutoCompleteBox at runtime.
DataSourceID property - set to the ID of your data source. This is mandatory when binding RadAutoCompleteBox declaratively.
DataMember property - if the data source is a DataSet and DataMember is a set, then RadAutoCompleteBox is bound to the DataTable with the respective name in the DataSet. If DataMember is not set, RadAutoCompleteBox is bound to the first DataTable in the DataSet.
DataTextField property - field name from the data source bound to the AutoCompleteBoxItemData's Text property.
DataValueField property - field name from the data source bound to the AutoCompleteBoxItemData's Value property.
DataBind method - is called after the aforementioned properties are set when binding at runtime.
DataBind method can be omitted when binding to a data source at runtime.
Using Templates with Data Bound Drop-Down Items
You can also use templates with a data bound RadAutoCompleteBox. To bind the defined template to column values, use DataBinder.Eval expressions in its definition.
<%# DataBinder.Eval(Container.DataItem, "ColumnName") %>
The Container.DataItem can be used to access AutoCompleteBoxItemData when it is in bound mode. AutoCompleteBoxItemData, however, must be bound before accessing its data from the DataItem.