title: The model item passed into the dictionary is of type, but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable
body: <p>Here is what I am trying to do. I don't understand Why it is expecting an enumerable list.</p>
  
  <p>AddressController.cs</p>
  
  <pre><code>public ActionResult ShowAddresses(List&lt;Address&gt; ReturnAddresses)
      {
          ShowAddressViewModel viewModel = new ShowAddressViewModel() { Addresses = ReturnAddresses, Message = "New" };
  return PartialView("_ShowAddr", viewModel);
  </code></pre>
  
  <p>}</p>
  
  <p>ShowAddressViewModel.cs</p>
  
  <pre><code>public class ShowAddressViewModel
  {
      public List&lt;Address&gt; Addresses { get; set; }
      public string Message { get; set; }
  }
  </code></pre>
  
  <p>_ShowAddr.cshtml</p>
  
  <pre><code>@model PeopleSoftControlsPOC.Models.ShowAddressViewModel
  &lt;script type="text/javascript"&gt;
  
  &lt;/script&gt;
  &lt;form&gt;
  &lt;div class="addressBlock"&gt;
  &lt;table id="AddressTable"&gt;
      @{int i = 0;}
       @{PeopleSoftControlsPOC.Models.ShowAddressViewModel AddrModel = Model;}
      @foreach (var item  in AddrModel.Addresses)
      {
          &lt;tr id = "@(i)"&gt;
              &lt;td&gt;@(AddrModel.Addresses[i].Address1)
              &lt;/td&gt;
              &lt;td&gt;@(AddrModel.Addresses[i].Address2)
              &lt;/td&gt;
              &lt;td&gt;@(AddrModel.Addresses[i].City)
              &lt;/td&gt;
              &lt;td&gt;@(AddrModel.Addresses[i].State)
              &lt;/td&gt;
              &lt;td&gt;@(AddrModel.Addresses[i].Zip)
              &lt;/td&gt;
          &lt;/tr&gt;
          @(i++)
      }
  &lt;/table&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>edit</p>
  
  <p>Call from Another partial view's java script</p>
  
  <pre><code>$.ajax(url, {
              data: { ReturnAddresses : InboundAddresses },
              type: 'POST',
              cache: false,
              crossDomain: true,
              success: function (data) {
                  //Populate the form values
                  // Start Dialog Code
                  $myWindow = jQuery('#myDiv');
                  //instantiate the dialog
                  $myWindow.html(data);
                  $myWindow.dialog({
                      title: 'Select an address',
                      modal: true,
                      width: 'auto'
                  });
                  $myWindow.show();
                  $myWindow.dialog("open");
                  // End Dialog Code
  
                  $('#AddressTable').on('click', 'tr', function () {
                      alert('You clicked row ' + ($(this).index()));
                  });
                  addAddress(Addresses, Message)
              },
              error: function (jqXHR, textStatus, errorThrown) {
                  $('#Message').val('Kaboom!!! (The call blew up...#thatsucks)');
                  alert('The Dialog Box call failed...Sorry :(');
              }
          });
      }
  </code></pre>
  
  <p>Server Error in '/PSPOC' Application.
      --------------------------------------------------------------------------------</p>
  
  <pre><code>The model item passed into the dictionary is of type 'PeopleSoftControlsPOC.Models.ShowAddressViewModel', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[PeopleSoftControlsPOC.Models.ShowAddressViewModel]'. 
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
  
  Exception Details: System.InvalidOperationException: The model item passed into the dictionary is of type 'PeopleSoftControlsPOC.Models.ShowAddressViewModel', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[PeopleSoftControlsPOC.Models.ShowAddressViewModel]'.
  
  Source Error: 
  
  An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  
  
  
  Stack Trace: 
  
  
  [InvalidOperationException: The model item passed into the dictionary is of type 'PeopleSoftControlsPOC.Models.ShowAddressViewModel', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[PeopleSoftControlsPOC.Models.ShowAddressViewModel]'.]
     System.Web.Mvc.ViewDataDictionary`1.SetModel(Object value) +383
     System.Web.Mvc.ViewDataDictionary..ctor(ViewDataDictionary dictionary) +625
     System.Web.Mvc.WebViewPage`1.SetViewData(ViewDataDictionary viewData) +74
     System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +138
     System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +378
     System.Web.Mvc.&lt;&gt;c__DisplayClass1c.&lt;InvokeActionResultWithFilters&gt;b__19() +33
     System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +727120
     System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +265
     System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +727076
     System.Web.Mvc.Controller.ExecuteCore() +159
     System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +334
     System.Web.Mvc.&lt;&gt;c__DisplayClassb.&lt;BeginProcessRequest&gt;b__5() +62
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass1.&lt;MakeVoidDelegate&gt;b__0() +15
     System.Web.Mvc.&lt;&gt;c__DisplayClasse.&lt;EndProcessRequest&gt;b__d() +52
     System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
     System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +288
  
  
  
  --------------------------------------------------------------------------------
  Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18044 
  </code></pre>