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

Binding issue

1 Answer 32 Views
ClientDataSource
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 27 Jul 2016, 01:42 PM

Hi,

I have the following client code and JSON output.  When I run it up I get no errors but I get an empty combo box. I know that the JSON is being generated and sent to the client datasource.

Have I missed something obvious?

<telerik:RadClientDataSource runat="server" ID="RadClientDataSource1">
    <DataSource>
        <WebServiceDataSourceSettings BaseUrl="http://localhost:65247/aTest/Data.asmx/">
            <Select Url="GetData" DataType="JSON" />
        </WebServiceDataSourceSettings>
    </DataSource>
    <Schema DataName="data">
        <Model>
            <telerik:ClientDataSourceModelField FieldName="Id" DataType="Number" />
            <telerik:ClientDataSourceModelField FieldName="Nme" DataType="String" />
            <telerik:ClientDataSourceModelField FieldName="Ena" DataType="Boolean" />
        </Model>
    </Schema>
</telerik:RadClientDataSource>
<telerik:RadComboBox ID="RadComboBox1" runat="server" ClientDataSourceID="RadClientDataSource1" EnableLoadOnDemand="true"
    DataTextField="Nme" DataValueField="Id">
</telerik:RadComboBox>

 

Sample JSON below - I have checked the whole file with a checker and it all seems OK...

{"data":[{"Id":97,"Nme":"sample 1","Ena":true},{"Id":182,"Nme":"sample 2","Ena":true}]}

 

 

1 Answer, 1 is accepted

Sort by
0
Jon
Top achievements
Rank 1
answered on 27 Jul 2016, 03:29 PM

Solved it.  I needed to ensure that the content type was set properly in the service 

Context.Response.ContentType = "application/json; charset=utf-8"

Tags
ClientDataSource
Asked by
Jon
Top achievements
Rank 1
Answers by
Jon
Top achievements
Rank 1
Share this question
or