title: ViewModel getting null values in action method
body: <p>I am using a ViewModel to retrieve entered data in controller action. But the ViewModel is getting empty values in it's properties. I am creating one <strong>partial view</strong></p>
  
  <p>and in that partial view I am creating <strong>drop down lists</strong> by binding the ViewModel and then I'm <strong>rendering</strong> that partial view in other <strong>View</strong></p>
  
  <p>Below is my code </p>
  
  <p>My ViewModel : </p>
  
  <pre><code>public class LookUpViewModel
      {
          RosterManagementEntities rosterManagementContext = new RosterManagementEntities();
          public  LookUpViewModel()
          {
  
              tblCurrentLocations = from o in rosterManagementContext.tblCurrentLocations select o;
              tblStreams = from o in rosterManagementContext.tblStreams select o;   
          }
  
          [Required]
          public virtual IEnumerable&lt;tblCurrentLocation&gt; tblCurrentLocations { get; set; }
  
   [Required]
          public virtual IEnumerable&lt;tblStream&gt; tblStreams {  get;  set; }
  </code></pre>
  
  <p>My Partial View:</p>
  
  <pre><code>@model PITCRoster.ViewModel.LookUpViewModel
  
  @Html.Label("Location")
  @Html.DropDownListFor(M=&gt;M.tblCurrentLocations, new SelectList(Model.tblCurrentLocations, "LocationId", "Location"), "Select Location")
  @Html.ValidationMessageFor(M=&gt;M.tblCurrentLocations)
  &lt;br /&gt;
  @Html.Label("Stream")
  
  @Html.DropDownListFor(M =&gt; M.tblStreams, new SelectList(Model.tblStreams, "StreamId", "Stream"), "Select Streams")
  @Html.ValidationMessageFor(M =&gt; M.tblStreams)
  </code></pre>
  
  <p>My View in which I am rendering this above partial view</p>
  
  <pre><code>@{
      ViewBag.Title = "Resources";
  }
  &lt;script src="~/Scripts/jquery.validate.min.js"&gt;&lt;/script&gt;
  &lt;script src="~/Scripts/jquery.validate.unobtrusive.min.js"&gt;&lt;/script&gt;
  &lt;h2&gt;Resources&lt;/h2&gt;
  
  @using (Html.BeginForm("AddResource", "Resources", FormMethod.Post))
  {
  
      @Html.AntiForgeryToken()
      @Html.ValidationSummary(true)
      Html.RenderPartial("_LookUpDropDowns", new PITCRoster.ViewModel.LookUpViewModel());
  
      &lt;br /&gt;
      &lt;input type="submit" value="Create" /&gt;
  }
  </code></pre>
  
  <p>And this is my controller action method : 
  [HttpPost]</p>
  
  <pre><code>public void AddResource(LookUpViewModel testName)
          {
              //code
          }
  </code></pre>
  
  <p>When I put a debugger on my controller action method control goes to that Action method.
  But ViewModel object has null in it.
  I tried accessing entered values using <strong>FormCollection</strong> object and I'm getting all the data as expected...</p>
  
  <p>Below is my code for controller action with <strong>FormCollection</strong> </p>
  
  <pre><code> [HttpPost]
          public void AddResource(FormCollection form)
          {
              var x = form["tblStreams"]; //I get value here..
          }
  </code></pre>
  
  <p>Can anybody explain me why I'm not getting values in ViewModel object ?
  Thank you...</p>