title: C# ASP.NET MVC error sharing model between parent and child view using Html.RenderPartial
body: <p>While invoking <code>@Html.RenderPartial("_ChildPartialView")</code>, I am getting the following error :</p>
  
  <blockquote>
    <p>System.Collections.Generic.ICollection' has no applicable method named 'ElementAt' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax</p>
  </blockquote>
  
  <p><strong>_Testpaper.cshtml</strong> parent view:</p>
  
  <pre><code>    for (i = 0; i &lt; Model.Questions.Count;i++)
      {
          ViewBag.QuestionNumber = i;
          Html.RenderPartial("_QuestionDetail"); //Line causing error
      }
  </code></pre>
  
  <p><strong>_QuestionDetail.cshtml</strong> child view:</p>
  
  <pre><code>@model StandardVBA.ViewModels.AssessmentModel
  &lt;tr style="padding:4px 0px; background-color:lightskyblue; font-weight:bold;font-family:Cambria;"&gt;
      &lt;td style="text-align:left;"&gt;
          Q @(ViewBag.QuestionNumber + 1) &amp;nbsp @Model.Questions.ElementAt(ViewBag.QuestionNumber).Question
      &lt;/td&gt;
      &lt;td style="text-align:center"&gt;
          ( @Model.Questions.ElementAt(ViewBag.QuestionNumber).Marks )
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td class="questions"&gt;
          &lt;ol type="A"&gt;
              @for (int j = 0; j &lt; Model.Questions.ElementAt(ViewBag.QuestionNumber).QuestionDetails.Count; j++)
              {
                  &lt;li&gt;
                      &lt;div style="display: inline-block; vertical-align: top;"&gt;
                          @Html.CheckBoxFor(m =&gt; m.Questions.ElementAt(ViewBag.QuestionNumber).QuestionDetails.ElementAt(j).IsSelected)
                      &lt;/div&gt;
  
                      @Html.DisplayFor(m =&gt; m.Questions.ElementAt(ViewBag.QuestionNumber).QuestionDetails.ElementAt(j).Choice)
                      @Html.HiddenFor(m =&gt; m.Questions.ElementAt(ViewBag.QuestionNumber).QuestionDetails.ElementAt(j).IsCorrect)
                  &lt;/li&gt;
              }
          &lt;/ol&gt;
  
      &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>I also want to know: why it is mandatory to specify the <code>@Model</code> in the child-view when the child-view shares the same model in a <code>RenderPartial</code> call?</p>