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

[Solved] RadGrid bug: this._dataSource[...] is null or not an object"

1 Answer 125 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ian
Top achievements
Rank 1
Ian asked on 04 Sep 2009, 04:59 PM
To populate a grid, I call an asmx web service and get back the following JSON string from the JavaScript deserializer:

[{"CustomerId":"ALFKI","ContactName":"Maria Anders","ContactTitle":"Sales Representative","Address":"Obere Str. 57","City":"Berlin","Region":"","PostalCode":"12209","Country":"Germany","Phone":"030-0074321","Fax":"030-0076545"}]

This is grid which is consuming the data:

        <telerik:RadGrid ID="GridCustomers" 
                runat="server" 
                AllowFilteringByColumn="true" 
                GridLines="None" 
                AllowPaging="true" 
                AllowSorting="true">
            <ClientSettings>
                <DataBinding Location="http://localhost/Niit/CustomerServices.asmx" 
                    EnableCaching="true" 
                    SortParameterType="Linq" 
                    SelectMethod="GetCustomers" 
                    SelectCountMethod="GetCount">
                    <DataService TableName="Customers" />
                </DataBinding>
            </ClientSettings>                
            <MasterTableView>
                <Columns>
                    <telerik:GridBoundColumn SortExpression="CustomerId" DataField="CustomerId" HeaderText="Customer ID" />
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>

At run time, I get an exception in the Telerik JavaScript file when this line of code is executed:

var x=this._dataSource[y][t];  // this line appears before "function U()"

This is the value of this._dataSource in the watch window:

this._dataSource = "[{"CustomerId":"ALFKI","ContactName":"Maria Anders","ContactTitle":"Sales Representative","Address":"Obere Str. 57","City":"Berlin","Region":"","PostalCode":"12209","Country":"Germany","Phone":"030-0074321","Fax":"030-0076545"}"; 

Any ideas as to why I'm getting this exception?

Thanks in advance.


1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 08 Sep 2009, 07:45 AM
Hello Ian,

I am afraid that we are not aware of such issue. You can check the following example which essentially does same as posted code:
http://demos.telerik.com/aspnet-ajax/grid/examples/client/declarativedatabinding/defaultcs.aspx

I have noticed that you have <DataService TableName="Customers" /> set. This is intended to use if you are binding RadGrid ADO.NET Data Services and don't need to set it if you are using any other services.

If you are still experience same behavior I will suggest you to send us sample project via formal support ticket or live url where we can observe it. 

Greetings,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Ian
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question
or