This is a migrated thread and some comments may be shown as answers.

Specifying fields for the $select option?

1 Answer 72 Views
ODataDataSource
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 2
Jason asked on 05 Jul 2012, 01:34 PM
Good morning,

I'm using an ODataDataSource to bind data to a RadComboBox. Currently the data source is retrieving all of the fields for each record whereas I'd like to only retrieve the fields I need for binding. I specified the fields (see code below) in the model declaration, which I would've expected to be passed on to the service call but that doesn't seem to be the case. 

Can you please let me know if this is a bug or if there is a way I can inject a $select clause to the service call?

Thanks, Jason

Markup:
<telerik:RadODataDataSource ID="dsComboBoxes" runat="server"
    ClientIDMode="Static">
</telerik:RadODataDataSource>               
 
<telerik:RadComboBox ID="cbxQuickAdd" runat="server"
    Width="100%" Height="190px" Skin="Simple"
    EnableLoadOnDemand="true"
    EmptyMessage="Type to Filter"
    EnableItemCaching="true"
    ODataDataSourceID="dsComboBoxes"
    DataModelID="Resource"
    DataTextField="Description"
    DataValueField="ID">
</telerik:RadComboBox>

Codebehind:
dsComboBoxes.Transport.Read.Url = ConfigurationManager.AppSettings.GetURL("BindingServiceURL");
dsComboBoxes.Transport.Read.DataType = ODataSourceResponseType.JSONP;
     
DataModel quickAdd = new DataModel()
{
    ModelID = groupType.Singularize(),
    Set = groupType
};
 
quickAdd.Fields.Add(new DataModelField() { FieldName = "ID" });
quickAdd.Fields.Add(new DataModelField() { FieldName = "Description" });
dsComboBoxes.Schema.Add(quickAdd);

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimitar Terziev
Telerik team
answered on 09 Jul 2012, 08:44 AM
Hello Jason,

You are right that the whole set of field is being retrieved even that a specific fields has been declared. Current the functionality to retrieve only the specified field is not implemented, but it will be available in the upcoming server pack.

Greetings,
Dimitar Terziev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
ODataDataSource
Asked by
Jason
Top achievements
Rank 2
Answers by
Dimitar Terziev
Telerik team
Share this question
or