This question is locked. New answers and comments are not allowed.
hi !
i am using Telerik Grid Control For ASP.NET MVC 3 using Entity Framework . I am facing the Internal Server Error 500 showing Circular reference Error when i debug in FireBug Software. i am making My Database Table Class Through Entity Framework
I Have all the Videos and Read out the Documentation Given By Telerik . i Have Also Checked Several Link Provided by Telerik i can get Any Solution but no solution Found. I also Check the Solution Provided by you in documentation and Forum .
http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-grid-troubleshooting.html
When i run my Code it run Successfully but in Browser it Gives Internal Server Error 500
Error Code Preview ;
LAYOUT.cshtml Code :
Index.cshtml Code Preview :
Product11Controller Code Preview:
Kindly Provide me Solution . I Have tried all the possible Way . But stil i am getting same Error.
i am using Telerik Grid Control For ASP.NET MVC 3 using Entity Framework . I am facing the Internal Server Error 500 showing Circular reference Error when i debug in FireBug Software. i am making My Database Table Class Through Entity Framework
I Have all the Videos and Read out the Documentation Given By Telerik . i Have Also Checked Several Link Provided by Telerik i can get Any Solution but no solution Found. I also Check the Solution Provided by you in documentation and Forum .
http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-grid-troubleshooting.html
When i run my Code it run Successfully but in Browser it Gives Internal Server Error 500
Error Code Preview ;
Server Error in '/' Application.A circular reference was detected while serializing an object of type 'System.Data.Entity.DynamicProxies.Product_D025CC9F846934B9148153EEB70F22BE0EBE70F9C243228A88436A18461B7A00'.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: A circular reference was detected while serializing an object of type 'System.Data.Entity.DynamicProxies.Product_D025CC9F846934B9148153EEB70F22BE0EBE70F9C243228A88436A18461B7A00'.Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.Stack Trace: [InvalidOperationException: A circular reference was detected while serializing an object of type 'System.Data.Entity.DynamicProxies.Product_D025CC9F846934B9148153EEB70F22BE0EBE70F9C243228A88436A18461B7A00'.] System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +1549 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +194 System.Web.Script.Serialization.JavaScriptSerializer.SerializeCustomObject(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +502 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +1424 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +194 System.Web.Script.Serialization.JavaScriptSerializer.SerializeCustomObject(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +282 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +1424 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +194 System.Web.Script.Serialization.JavaScriptSerializer.SerializeEnumerable(IEnumerable enumerable, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +126 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +1380 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +194 System.Web.Script.Serialization.JavaScriptSerializer.SerializeDictionary(IDictionary o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +527 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +1319 System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +194 System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj, StringBuilder output, SerializationFormat serializationFormat) +26 System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj, SerializationFormat serializationFormat) +74 System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj) +6 System.Web.Mvc.JsonResult.ExecuteResult(ControllerContext context) +216 System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13 System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +23 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +260 System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +19 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +177 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343 System.Web.Mvc.Controller.ExecuteCore() +116 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10 System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37 System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21 System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62 System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50 System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7 System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8970061 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272LAYOUT.cshtml Code :
<html><head> <meta charset="utf-8" /> <title>@ViewBag.Title</title> <script src="../../Scripts/jquery-1.7.1.min.js" type="text/javascript"></script> <script src="../../Scripts/jquery.validate.min.js" type="text/javascript"></script> @(Html.Telerik().StyleSheetRegistrar() .DefaultGroup(group => group .Add("telerik.examples.css") .Add("telerik.common.css") .Add("telerik.Black.css") .Add("telerik.rtl.css") ))</head><body> @RenderBody() @(Html.Telerik().ScriptRegistrar() .DefaultGroup(group => group .Add("telerik.examples.js") .Compress(true)) .OnDocumentReady( @<text> prettyPrint(); </text>) )</body></html>Index.cshtml Code Preview :
@model CommerceSuite.Data.Product @{ ViewBag.Title = "Index";}<h2>AJAX BINDING</h2>@(Html.Telerik().Grid<CommerceSuite.Data.Product>("PRODUCT") .Name("Grid") .Columns(columns => { columns.Bound(o => o.ProductId).Title("ID").Width(100); columns.Bound(o => o.Title).Title("Name"); columns.Bound(o => o.CategoryId).Title("CategoryID"); }) .DataBinding(d => d .Ajax() .Select("AjaxGrid", "PRODUCT11") ) .Pageable() .Sortable() .Filterable() .Groupable() )Product11Controller Code Preview:
using System;using System.Collections;using System.Collections.Generic;using System.Data;using System.Data.Entity;using System.Data.Linq;using System.Linq;using System.ServiceModel;using System.Web;using System.Web.Caching;using System.Web.Mvc;using Telerik.Web.Mvc.UI;using Telerik.Web.Mvc;using CommerceSuite.Data;namespace CommerceSuite.Web.Administration.Controllers{ public class PRODUCT11Controller : Controller { public CommerceSuiteWMDBEntities db = new CommerceSuiteWMDBEntities(); // // GET: /PRODUCT11/ public ViewResult Index() { ViewData["PRODUCT"] = db.Products.ToList(); return View( ); } [GridAction] public ActionResult AjaxGrid() { return View(new GridModel(db.Products)); } // GET: /PRODUCT11/Details/5 public ViewResult Details(long id) { Product product = db.Products.Find(id); return View(product); } // // GET: /PRODUCT11/Create public ActionResult Create() { return View(); } // // POST: /PRODUCT11/Create [HttpPost] public ActionResult Create(Product product) { if (ModelState.IsValid) { db.Products.Add(product); db.SaveChanges(); return RedirectToAction("Index"); } return View(product); } // // GET: /PRODUCT11/Edit/5 public ActionResult Edit(long id) { Product product = db.Products.Find(id); return View(product); } // // POST: /PRODUCT11/Edit/5 [HttpPost] public ActionResult Edit(Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(product); } // // GET: /PRODUCT11/Delete/5 public ActionResult Delete(long id) { Product product = db.Products.Find(id); return View(product); } // // POST: /PRODUCT11/Delete/5 [HttpPost, ActionName("Delete")] public ActionResult DeleteConfirmed(long id) { Product product = db.Products.Find(id); db.Products.Remove(product); db.SaveChanges(); return RedirectToAction("Index"); } protected override void Dispose(bool disposing) { db.Dispose(); base.Dispose(disposing); } public IQueryable<Product> Pro { get; set; } }}Kindly Provide me Solution . I Have tried all the possible Way . But stil i am getting same Error.