title: How can I solve this "System.Data.Entity.DynamicProxies" error
body: <p>I am new to Linq and EF Code First and came across an issue that I just can't figure out.  I am developing a proof of concept examination program using ASP.Net Web Forms, EF Code First and Linq.  The ideas is that I generate the page's server controls dynamically based on the database.  I've built this same application before without EF but was hoping to learn that on this project.  I can get the correct results if I use a literal but am receiving an error while databinding a RadioButtonList.</p>
  
  <pre><code>DataBinding: 'System.Data.Entity.DynamicProxies.Choice_EA448AD48C19F54FBB6BF09B7A03BA899DBE75EC189635A8982E7C3B1D8F4ABD' does not contain a property with the name '4'.
  
  Line 34:                 content.Controls.Add(ql);
  Line 35:                 ql.DataSource = choices;
  Line 36:                 ql.DataBind();            
  Line 37:         }
  </code></pre>
  
  <p>The property with the name of '4' is just a value from my database.  I'm not sure if this problem is related to Lazy Loading or just lack of knowledge in proper Linq but I would really appreciate it if someone can point me in the right direction.  </p>
  
  <p>Here are my three Class files I am using and the C# page that I am trying to build.  Keep in mind I plan to separate the data access into another class but was just trying to get a demo working for myself.
  Exam.cs</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.ComponentModel.DataAnnotations;
  
  /// &lt;summary&gt;
  /// Summary description for Exam
  /// &lt;/summary&gt;
  public class Exam
  {    
      public int ExamId { get; set; }
  
      public string Title { get; set; }
  
      public string Description { get; set; }
  
      public bool Status { get; set; }
  
      public DateTime DateCreated { get; set; }
  
      public string CreatedBy { get; set; }
  
      public virtual ICollection&lt;Question&gt; Questions { get; set; }
  }
  </code></pre>
  
  <p>Question.cs</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  
  /// &lt;summary&gt;
  /// Summary description for Question
  /// &lt;/summary&gt;
  public class Question
  {
      public int QuestionId { get; set; }
  
      public string QuestionText { get; set; }
  
      public int Order { get; set; }
  
      public DateTime DateCreated { get; set; }
  
      public bool Status { get; set; }
  
      public string CreatedBy { get; set; }
  
      public string QuestionType { get; set; }
  
      public int ExamId { get; set; }
  
      public virtual Exam Exam { get; set; }
  
      public virtual ICollection&lt;Choice&gt; Choices { get; set; }
  }
  </code></pre>
  
  <p>Choice.cs</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  
  /// &lt;summary&gt;
  /// Summary description for Choice
  /// &lt;/summary&gt;
  public class Choice
  {
      public int ChoiceId { get; set; }
  
      public string ChoiceText { get; set; }
  
      public int Order { get; set; }
  
      public bool Status { get; set; }
  
      public bool Correct { get; set; }
  
      public DateTime DateCreated { get; set; }
  
      public string CreatedBy { get; set; }
  
      public int QuestionId { get; set; }
  
      public virtual Question Question { get; set; }
  }
  </code></pre>
  
  <p>Testing.aspx.cs</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  
  public partial class Testing : System.Web.UI.Page
  {
  
      protected void Page_Load(object sender, EventArgs e)
      {
          ExamsContext db = new ExamsContext();
  
          var questions = (from c in db.Exams
                       from q in c.Questions
                       where c.ExamId == 1
                       select q).ToList();
          ContentPlaceHolder content = (ContentPlaceHolder)this.Master.FindControl("MainContent");
          foreach (var question in questions)
          {
              Literal questionLabel = new Literal();
              questionLabel.Text = Convert.ToString(question.QuestionId) + ".&amp;nbsp;" + question.QuestionText + "&lt;br/&gt;";
              content.Controls.Add(questionLabel);
  
              var choices = (from c in question.Choices select c).ToList();
  
              RadioButtonList ql = new RadioButtonList();   
                  foreach (var choice in choices)
                  {
                      ql.DataValueField = Convert.ToString(choice.ChoiceId);
                      ql.DataTextField = choice.ChoiceText;
                  }
                  content.Controls.Add(ql);
                  ql.DataSource = choices;
                  ql.DataBind();            
          }        
      }
  }
  </code></pre>