Binding issue

2 posts, 0 answers
  1. Jon
    Jon avatar
    813 posts
    Member since:
    Oct 2008

    Posted 27 Jul Link to this post

    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}]}

     

     

  2. Jon
    Jon avatar
    813 posts
    Member since:
    Oct 2008

    Posted 27 Jul in reply to Jon Link to this post

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

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

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top