1

I am trying to fill gridpanel to get data from database through LINQ in .net framework 3.5 MVC and in Extjs MVC.

I am able to archive to get all data sucessfully from following code

public Object Get()
{
     var employeeList = _db.Employees;
     var result = new
     {
         data = employeeList
     };
     return this.Json(result, JsonRequestBehavior.AllowGet);
}

but when i am passing data to extjs model it will give following Error enter image description here

I am able to get my all data from database but Don't know where I am wrong?

Smily
  • 2,646
  • 4
  • 23
  • 31

1 Answers1

4

The circular reference is caused by the Json serialization.

See my post here: Preventing StackOverflowException while serializing EF object graph into Json

This post might also help you: EntityFramework to Json workaround?

Community
  • 1
  • 1
Ofer Zelig
  • 17,068
  • 9
  • 59
  • 93
  • Ofer Zelig i had read your post and i am implementing [ScriptIgnore] but I am getting error like **Attribute 'ScriptIgnore' is not valid on this declaration type. It is only valid on 'property, indexer, field' declarations.** – Smily Apr 06 '12 at 10:29
  • So do as the exception says... you probably didn't put [ScriptIgnore] on the right place, as it says. – Ofer Zelig Apr 07 '12 at 17:31
  • What we do with Silverlight ? there is no system.web.extn.. Can i have a alternative ? – NO Name Oct 16 '12 at 08:45
  • You can still reference System.Web etc. – Ofer Zelig Oct 16 '12 at 12:27