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

Can one swop out DefaultJavaScriptSerializer

1 Answer 94 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shawn
Top achievements
Rank 2
Shawn asked on 09 Aug 2012, 08:49 AM
I am getting the following error when binding my Model to a Kendo Grid.
InvalidOperationException: A circular reference was detected while serializing an object of type [my type here]

Using the Json.Net serializer with a setting to ignore circular references I am able to get my type serialized without error. So, what I'd like to be able to do is to tell the Kendo framework to use the Json.Net serializer instead of its own built-in DefaultJavaScriptSerializer.  Is this possible?  I see it implements an IJavaScriptSerializer interface, so I'm hoping I can create my own class that implements this interface (and uses the Json.Net serializer).  But I can't figure out how one would tell the Kendo.Mvc.Infrastructure to use my custom implementation of IJavaScriptSerializer.
Please help.

1 Answer, 1 is accepted

Sort by
0
JFB
Top achievements
Rank 1
answered on 11 Oct 2012, 12:09 PM
I am having the same problem...

A circular reference was detected while serializing an object of type [my type]

                                           
@(Html.Kendo().Grid(Model)
    .Name("Grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.Name).Groupable(false);
    })
    .Pageable()
    .Sortable()
    .Scrollable()
    .Filterable()   
    .DataSource(dataSource => dataSource       
        .Ajax()
        .ServerOperation(false)       
     )
)
   
                                            
Tags
Grid
Asked by
Shawn
Top achievements
Rank 2
Answers by
JFB
Top achievements
Rank 1
Share this question
or