title: ASP.Net C# MVC EditorFor Template not being called from main razor view
body: <p>I'm trying to setup an EditorTemplate for a repeating class (Offer) - however, I'm having trouble getting the EditorTemplate to show.  It's as if it just isn't being found in the EditorTemplates folder:</p>
  <p>My ViewModel is:</p>
  <pre><code>    public class CreateViewModel
      {
      public IList&lt;OfferVM&gt; Offers { get; set; }
      public OfferVM Header
      {
          get
          {
              return Offers.FirstOrDefault();
          }
      }
  }
  
  public class OfferVM
  {
      public int RoomTypeId { get; set; }
      public int PropertyId { get; set; }
      public string RoomTypeName { get; set; }
      public string Layout { get; set; }
      public decimal RoomRate { get; set; }
      public string Inclusions { get; set; }
      public string Property { get; set; }
      public bool IncludeInOffer { get; set; }
      }
  </code></pre>
  <p>My Controller Get code is:</p>
  <pre><code>    //
      // GET: /Offer/Create
  
      public ActionResult Create()
      {
          
          var roomtypes = db.RoomTypes.Include(r =&gt; r.Property).ToList();
          var vm = new CreateViewModel();
          vm.Offers = Mapper.Map&lt;IList&lt;RoomType&gt;, IList&lt;OfferVM&gt;&gt;(roomtypes);
         return View(vm);
      }
  </code></pre>
  <p>The controller works fine - I can see it populated in VS.</p>
  <p>My Create.cshtml code is:</p>
  <pre><code>@model FGBS.ViewModels.CreateViewModel
  @{
  ViewBag.Title = &quot;Create&quot;;
  }
  
  &lt;h2&gt;Create&lt;/h2&gt;
  
  @using (Html.Bootstrap().Begin(new Form().Type(FormType.Horizontal))) {
  @Html.AntiForgeryToken()
  @Html.ValidationSummary(true)
  
  &lt;fieldset&gt;
      &lt;legend&gt;&lt;/legend&gt;
  
  
  &lt;table&gt;
  &lt;tr&gt;
      &lt;th&gt;
          @Html.DisplayNameFor(model =&gt; model.RoomTypeId)
      &lt;/th&gt;
      &lt;th&gt;
          @Html.DisplayNameFor(model =&gt; model.PropertyId)
      &lt;/th&gt;
      &lt;th&gt;
          @Html.DisplayNameFor(model =&gt; model.RoomTypeName)
      &lt;/th&gt;
      &lt;th&gt;
          @Html.DisplayNameFor(model =&gt; model.Layout)
      &lt;/th&gt;
      &lt;th&gt;
          @Html.DisplayNameFor(model =&gt; model.RoomRate)
      &lt;/th&gt;
      &lt;th&gt;
          @Html.DisplayNameFor(model =&gt; model.Inclusions)
      &lt;/th&gt;
      &lt;th&gt;
          @Html.DisplayNameFor(model =&gt; model.Property)
      &lt;/th&gt;
      &lt;th&gt;
          @Html.DisplayNameFor(model =&gt; model.IncludeInOffer)
      &lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;/tr&gt;
  
        @Html.EditorFor(x =&gt; x.Offers) 
  
      &lt;/table&gt;
  </code></pre>
  <p>Then in my Views/Shared/EditorTemplates folder I have my Offers.cshtml file:</p>
  <pre><code>@model FGBS.ViewModels.OfferVM
  
  @{
      Layout = null;
  }
    &lt;tr&gt;
      &lt;td&gt;
          @Html.EditorFor(model =&gt; model.RoomTypeId)
          @Html.ValidationMessageFor(model =&gt; model.RoomTypeId)
      &lt;/td&gt;
  
     
      &lt;td&gt;
          @Html.EditorFor(model =&gt; model.PropertyId)
          @Html.ValidationMessageFor(model =&gt; model.PropertyId)
      &lt;/td&gt;
  
      
      &lt;td&gt;
          @Html.EditorFor(model =&gt; model.RoomTypeName)
          @Html.ValidationMessageFor(model =&gt; model.RoomTypeName)
      &lt;/td&gt;
  
      
      &lt;td&gt;
          @Html.EditorFor(model =&gt; model.Layout)
          @Html.ValidationMessageFor(model =&gt; model.Layout)
      &lt;/td&gt;
  
     
      &lt;td&gt;
          @Html.EditorFor(model =&gt; model.RoomRate)
          @Html.ValidationMessageFor(model =&gt; model.RoomRate)
      &lt;/td&gt;
  
     
      &lt;td&gt;
          @Html.EditorFor(model =&gt; model.Inclusions)
          @Html.ValidationMessageFor(model =&gt; model.Inclusions)
      &lt;/td&gt;
  
     
      &lt;td&gt;
          @Html.EditorFor(model =&gt; model.Property)
          @Html.ValidationMessageFor(model =&gt; model.Property)
      &lt;/td&gt;
  
      
      &lt;td&gt;
          @Html.EditorFor(model =&gt; model.IncludeInOffer)
          @Html.ValidationMessageFor(model =&gt; model.IncludeInOffer)
    &lt;/td&gt;
  
      &lt;/tr&gt;
  </code></pre>
  <p><img src="https://i.stack.imgur.com/QwmJa.png" alt="ss" /></p>
  <p>However, when I run the code, I get no error, but my template doesn't display.</p>
  <p>I have tried changing the template to just have:</p>
  <pre><code>&lt;tr&gt;&lt;td&gt;test&lt;/td&gt;&lt;/tr&gt;
  </code></pre>
  <p>But it still doesn't display - which suggests the EditorFor is not &quot;finding&quot; the Offers.cshtml file in the editortemplates folder.</p>
  <p>I have also tried adding a breakpoint in Offers.cshtml, but VS doesn't stop within it, implying it isn't being hit.</p>
  <p>Is there anything wrong with my setup, or the placement of the Offers.cshtml file?</p>
  <p>Thank you,</p>
  <p>Mark</p>