Specifying fields for the $select option?

2 posts, 1 answers
  1. Jason
    Jason avatar
    1 posts
    Member since:
    Nov 2011

    Posted 05 Jul 2012 Link to this post

    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);
  2. Answer
    Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 09 Jul 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top