title: Add namespace to web.config in View folder
body: <p>In my ASP MVC 3 site, I am trying to use the <code>BeginCollectionItem</code> dll from <a href="http://blog.stevensanderson.com/2010/01/28/editing-a-variable-length-list-aspnet-mvc-2-style/" rel="nofollow">Steve Sanderson's blog post</a>. I have my partial view set up like so</p>
  
  <pre><code>@model Monet.Models.DropDownValues
  
  @using (HtmlHelpers.BeginCollectionItem("drop"))
  {
      @Html.HiddenFor(model =&gt; model.Field)
      @Html.HiddenFor(model =&gt; model.DisplayPage)
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.AllowedValue)
      &lt;/div&gt;
      &lt;div class="label-field"&gt;
          @Html.EditorFor(model =&gt; model.AllowedValue)
          @Html.ValidationMessageFor(model =&gt; model.AllowedValue)
      &lt;/div&gt;
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.DisplayValue)
      &lt;/div&gt;
      &lt;div class="label-field"&gt;
          @Html.EditorFor(model =&gt; model.DisplayValue)
          @Html.ValidationMessageFor(model =&gt; model.DisplayValue)
      &lt;/div&gt;
  }
  </code></pre>
  
  <p>However even though <code>BeginCollectionItem</code> appears as an option under the <code>HtmlHelpers</code> namespace, I get the following error: </p>
  
  <pre><code>'HtmlHelpers.BeginCollectionItem' is a 'namespace', which is not valid in the given context
  </code></pre>
  
  <p>I believe I have the namespace set correctly in the web.config located in the Views folder, however I'm relatively new to ASP MVC so not 100%</p>
  
  <pre><code>  &lt;sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"&gt;
      &lt;section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /&gt;
      &lt;section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /&gt;
    &lt;/sectionGroup&gt;
  &lt;/configSections&gt;
  &lt;system.web.webPages.razor&gt;
    &lt;host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
    &lt;pages pageBaseType="System.Web.Mvc.WebViewPage"&gt;
      &lt;namespaces&gt;
        &lt;add namespace="System.Web.Mvc" /&gt;
        &lt;add namespace="System.Web.Mvc.Ajax" /&gt;
        &lt;add namespace="System.Web.Mvc.Html" /&gt;
        &lt;add namespace="System.Web.Routing" /&gt;
        &lt;add namespace="HtmlHelpers.BeginCollectionItem" /&gt;
      &lt;/namespaces&gt;
    &lt;/pages&gt;
  &lt;/system.web.webPages.razor&gt;
  </code></pre>