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

[Solved] Circular Reference

3 Answers 132 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
revm
Top achievements
Rank 1
revm asked on 11 Nov 2009, 01:56 PM
Hi there,

I've been getting a 500 error from my server while trying to implement the Ajax Binding capability of the grid. It turns out this is due to a Circular Reference when the object is being serialized.

I had a look at your example and noticed that in your Northwind.dbml you have set the Child Property of the Customer_Order Association to FALSE. When I switch this to TRUE I get the same error with your example. I would like to keep my associations so is there another way around the Circular Reference problem?

Thanks,
Ross

3 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 11 Nov 2009, 02:01 PM
Hello Ross Mealor,

The circular reference exists because there is the following relation Order -> Customer -> Order. The JavaScript serializer detects that and raises exception. The first way to solve is like we did - remove the Customer_Order association. The other is to use a ViewModel object to serialize only what is required as demonstrated in this blog post.

All the best,
Atanas Korchev
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.
0
revm
Top achievements
Rank 1
answered on 11 Nov 2009, 03:00 PM
Thanks Atanas,

For reference when I initially tried that I wasn't returning the primary key which meant the linq query wasn't able to skip() and caused an error.

Thanks for your speedy help,
Ross
0
Daniel Cotter
Top achievements
Rank 1
answered on 12 Nov 2009, 06:30 PM
I was having the same problem. Here's how I fixed it.

Daniel
Tags
Grid
Asked by
revm
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
revm
Top achievements
Rank 1
Daniel Cotter
Top achievements
Rank 1
Share this question
or