title: Asp.net lazy loading related entities
body: <p>I am using Asp.net vs 2012 my classes are </p>
  
  <pre><code>public class klasa
  {
      [Key]
      public int klasaid { get; set; }
      public string emriklases { get; set; }
      public string vendodhja { get; set; }
      public virtual ICollection&lt;student&gt; students { get; set; }
  }
  public class student
  {
      [Key]
      public int studentid { get; set; }
      public string emristudent { get; set; }
      public int nota { get; set; }
      public int klasaid { get; set; }
      [ForeignKey("klasaid")]
      public klasa Klasa { get; set; }
  </code></pre>
  
  <p>Student List Controller</p>
  
  <pre><code>udb _db = new udb();
  public ActionResult Index([Bind(Prefix="klsasaid")] int klasaid)
  {
      var studentlist = _db.Seuni.Find(klasaid);
      if (studentlist != null)
      {
          return View();
      }
      return HttpNotFound();
  }
  </code></pre>
  
  <p>StudentList View Index </p>
  
  <pre><code>@model Unilast.Models.klasa
  &lt;h2&gt;List for @Model.emriklases &lt;/h2&gt;
  @Html.Partial("_partial1", @Model.students);
  &lt;p&gt;@Html.ActionLink("Create New", "Create")&lt;/p&gt;
  </code></pre>
  
  <p>_partial1 view as below:</p>
  
  <pre><code>@model IEnumerable&lt;Unilast.Models.student&gt;
  
  &lt;table&gt;
      &lt;tr&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.emristudent)
          &lt;/th&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.nota)
          &lt;/th&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.klasaid)
  </code></pre>
  
  <p>Lazy loading entities does not work.</p>
  
  <blockquote>
    <p>The parameters dictionary contains a null entry for parameter 'klasaid' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Index(Int32)' in 'Unilast.Controllers.StudentListController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
    Parameter name: parameters</p>
  </blockquote>
  
  <p>This is the error it dispplays
  View is </p>