Click here to Skip to main content
15,882,464 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi guys

I get this error and not sure what to do, please help.

Error:"A circular reference was detected while serializing an object of type "

var context = HttpContext.Current;
            int rowCount = -1;

            var property = db_Property.getEveryProperty(0, 10, "", ref rowCount);

            JavaScriptSerializer js = new JavaScriptSerializer();

return js.Serialize(new { aaData = property, count = rowCount });//Error is here

//Methos contents
using (var context = new dbPropertyManagerEntities())

               var query = from row in context.tbl_Property
                           select row;

               if (!string.IsNullOrEmpty(searchTerm))
                   query = query.Where(row => row.propName.Contains(searchTerm) || row.propAddress.Contains(searchTerm));
               query = query.OrderBy(s => s.propName);

               var qRowCount = query.Count();
               var qRow = query.Skip(skip).Take(take);

               rowCount = qRowCount;
               context.ContextOptions.LazyLoadingEnabled = false;
               return qRow.ToList();

Thanks7872 10-Sep-13 5:52am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900