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

Retrieving Json from Controller Action

2 Answers 215 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Varghese
Top achievements
Rank 1
Varghese asked on 12 Dec 2011, 09:53 PM

I'm using the kendoChart to display the json result from a controller action. The contoller action is getting called, but the page gives an error after that which is shown at the bottom of this message. I tried to catch the dataBound event to see what is happening. The error is happening even before the event, so can't catch it.

An example or help appreciated for this problem.

Controller Action:

...
return Json(itemCount, JsonRequestBehavior.AllowGet);

Script:

$("#liveChart").kendoChart({
...
dataSource: new kendo.data.DataSource({
 transport: {
  read: {
   url: "/Charts/Orders/GetLiveOrdersCount",
   dataType: "json"
  }
 },
 schema: {
  data: "data"
 }
}),
...

Error:

SCRIPT5007: Unable to get value of the property 'length': object is null or undefined
kendo.all.min.js, line 11 character 46965

2 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 13 Dec 2011, 01:07 PM
Hello Varghese,

I suspect that the following configuration is not valid:
schema: {
 data: "data"
}

Does the data field of the returned JSON have actual data?

All the best,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Varghese
Top achievements
Rank 1
answered on 13 Dec 2011, 05:01 PM
Thanks. I removed "data" from the schema and it worked fine.
Tags
Data Source
Asked by
Varghese
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Varghese
Top achievements
Rank 1
Share this question
or