New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
Binding to OData
Updated over 6 months ago
As from Q3 2011, RadComboBox supports binding to an OData service.
The Open Data Protocol (OData) is an open web protocol for querying and updating data. The protocol allows the consumers to query data over an HTTP protocol and get the result back in formats like JSONP and plain XML, including data pagination, ordering, or filtering.
In its current state, RadComboBox supports only data paging.
Flat OData Binding
Flat OData Binding means binding to a non-hierarchical data. Here is an example which demonstrates how to perform the OData binding on RadComboBox using the RadODataDataSource control.
Set the following properties:
- Set the
EnableLoadOnDemandproperty totrue. - Set the
ODataDataSourceIDproperty to theIDof the RadODataDataSource component. - Set the
DataModelIDproperty to the ID of the data Model defined in the RadODataDataSource component. - Set the
DataTextFieldproperty to the name of a data source field to be mapped to the ComboBoxItemTextproperty. - Set the
DataValueFieldproperty to the name of a data source field to be mapped to the ComboBoxItemValueproperty.
Markup
ASPNET
<telerik:RadComboBox RenderMode="Lightweight" ID="RadComboBox1" runat="server" EnableLoadOnDemand="true"
ODataDataSourceID="RadODataDataSource1" DataModelID="Category"
DataTextField="CategoryName" DataValueField="CategoryID"
ShowMoreResultsBox="true" ItemsPerRequest="4">
</telerik:RadComboBox>
<telerik:RadODataDataSource runat="server" ID="RadODataDataSource1">
<Transport>
<Read Url="http://services.odata.org/Northwind/Northwind.svc/" DataType="JSONP"/>
</Transport>
<Schema>
<telerik:DataModel ModelID="Category" Set="Categories">
<telerik:DataModelField FieldName="CategoryID" />
<telerik:DataModelField FieldName="CategoryName" />
</telerik:DataModel>
</Schema>
</telerik:RadODataDataSource>
For more information about OData, please refer to OData Documentation.