title: Complex model and Partial View
body: <p>I am having a problem in accessing my viewmodel and its partial view model data in controller</p>
  
  <p><strong>My Model</strong></p>
  
  <pre><code>public class SearchRequest : BaseRequest
  {
      public SearchOptions SearchBy{ get; set; }
      // and other properties also there
  }
  
  [KnownType(typeof(SearchByAirport))]
  [KnownType(typeof(SearchByCity))]
  [KnownType(typeof(SearchByProductCodes))]
  [KnownType(typeof(SearchByGeocode))]
  public abstract class SearchOptions
  {
  }
  
  public class SearchByProductCodes : SearchOptions
  {
      public List&lt;string&gt; Codes { get; set; }
  }
  public class SearchByGeocode : SearchOptions
  {
  // few more properties
  }
  </code></pre>
  
  <p><strong>My View</strong></p>
  
  <p>View has model reference for <code>SearchRequest</code> and has a drop down for selecting search category (i.e. search by product codes , geo code, city etc. etc.) and on change of drop down i load my partial view </p>
  
  <p>One of my partial view </p>
  
  <pre><code> @model Tavisca.Catapult.External.DataContract.Common.SearchByProductCodes 
  
  &lt;div class="form-group"&gt;
      @Html.LabelFor(model =&gt; model.Codes, new { @class = "control-label col-md-2" })
      &lt;div class="col-md-10"&gt;
          @Html.TextBoxFor(model =&gt; model.Codes)
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Controller</strong> </p>
  
  <pre><code>[HttpPost]
  public ActionResult Create(SearchRequest hotelSearchRequest)
  {
      return View();
  }
  </code></pre>
  
  <p>i am getting <code>SearchBy</code> Null here, What is the best approach to arrange my view and get all fields from view to controller.</p>