This question is locked. New answers and comments are not allowed.
I've run into a problem with the Telerik Grid Expression builder and the Ajax binding support. My model is based on an EF 4 Object Set. If I have an IQueryable<Appointment> and use this as the data source for my grid then I get the DB side paging (which I need since the table is ~64,000 records). However since the Appointment entity has a relationship to SalesRep I get a circular reference error when serializing IQueryaby<Appointment> to JSON (there is no actual circular reference SalesRep to Appointment is a standard parent/child relationship.)
I was able to get around the JSON serialization error by iterating over my collection and converting it into a ViewModel collection:
My problem now is that since I am now minding to IList instead of IQueryable the entire result set is being sent to View and paging is being managed there.
Is there any way to address the JSON serialization issue but still get database side paging?
Thank you,
Justin
I was able to get around the JSON serialization error by iterating over my collection and converting it into a ViewModel collection:
| [Telerik.Web.Mvc.GridAction] |
| public ActionResult _AjaxBinding() |
| { |
| AppointmentRepository appointmentRepository = new AppointmentRepository(); |
| List<AppointmentGridItemViewModel> appointmentGridItems = new List<AppointmentGridItemViewModel>(); |
| IQueryable<Appointment> appointments = appointmentRepository.ListAppointments(); |
| foreach (Appointment app in appointments) |
| { |
| appointmentGridItems.Add(new AppointmentGridItemViewModel(app)); |
| } |
| return View(new Telerik.Web.Mvc.GridModel<AppointmentGridItemViewModel> |
| { |
| Data = appointmentGridItems |
| }); |
| } |
My problem now is that since I am now minding to IList instead of IQueryable the entire result set is being sent to View and paging is being managed there.
Is there any way to address the JSON serialization issue but still get database side paging?
Thank you,
Justin