title: MVC4 : Sending child Partial view values to controller?
body: <p>First of all I must say this I am new to MVC4 and developing this app and learning MVC4 simultaneously :).</p>
  
  <p>In this app,
  Below is the <strong>parent view</strong> where 3 partial views are rendered also there is one button:</p>
  
  <pre><code>[code]
   &lt;td id="track"&gt;@Html.Partial("_Track",Model)&lt;/td&gt;&lt;br&gt;
  &lt;td id="tech"&gt;
   &lt;div id="Technologies"&gt; @Html.Partial("_Technology",Model)
  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt; 
  ..
  [some code]
  ..
  
  &lt;td class="subtopic"&gt;
   &lt;div class="subtopiclist" id="subque"&gt;@Html.Partial("_Subtopics",Model)&lt;/div&gt;&lt;br&gt;
   &lt;input type="Submit" value="Fetch Interview Questions" name="Fetch" id="Fetch" /&gt;
             &lt;/td&gt;
  </code></pre>
  
  <p>Partial View1 (it contains dropdownlist) :</p>
  
  <pre><code>@model MvcApplication3.Models.CommonWrapper
  
  @using (Ajax.BeginForm("SelectTrack", "Home", new AjaxOptions { UpdateTargetId = "Technologies" }))
  { 
      @Html.DropDownListFor(
              m=&gt;m.SelectedTrackId,
              new SelectList(Model.track, "TrackId", "TrackName"),
             string.Empty
          )
  }
    &lt;script type="text/javascript"&gt;
      $('#SelectedTrackId').change(function () {
          $(this).parents('form').submit();
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>Parital View2 (it contains dropdownlist):</p>
  
  <pre><code>@model MvcApplication3.Models.CommonWrapper
  @if (Model.tech != null &amp;&amp; Model.tech.Count() &gt; 0)
  {
      using (Ajax.BeginForm("SelectTechnology", "Home", new AjaxOptions { UpdateTargetId = "subque" }))
      { 
       @Html.HiddenFor(m =&gt; m.SelectedTrackId)
       @Html.DropDownListFor(
              m =&gt; m.SelectedTechId,
              new SelectList(Model.tech, "TechId", "TechName"),
              string.Empty
              )
      }
  }
  
    &lt;script type="text/javascript"&gt;
      $(document).on('change', '#SelectedTechId', function () {
          $(this).parents('form').submit();
      });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>Partial view 3 (it contains multiple checkboxes):</p>
  
  <pre><code>@if (Model.subtopic != null &amp;&amp; Model.subtopic.Count() &gt; 0)
  {
  &lt;table&gt;
  @for (int i = 0; i &lt; Model.subtopic.Count; i++)
  {
   &lt;tr&gt;&lt;td&gt;
      @Html.CheckBoxFor(m =&gt; m.subtopic[i].IsSelected, new { id = "subTopic_" + i })
      @Html.HiddenFor(m =&gt; m.subtopic[i].SubtopicName)
      @Html.DisplayFor(m =&gt; m.subtopic[i].SubtopicName)
       &lt;td&gt;
       &lt;/tr&gt;   
  }
  &lt;/table&gt;
  
  }
  </code></pre>
  
  <p>Now In parent view, I want to fetch the values from these three partial views.Also, I need to send these fetched values to controller.<br>
  How to do this ? can anybody please help me on this.<br>
  Thanks in advance </p>
  
  <p>Added controller code :</p>
  
  <pre><code>[HttpPost]
          public ActionResult SelectTrack(int? selectedTrackId)
          {
              CommonWrapper wrapper = new CommonWrapper();
              wrapper.tech = new List&lt;TechModel&gt;();
  
              if (selectedTrackId.HasValue)
              {
                  wrapper.tech = (from s in CommonWrapper.GetTechnology()
                                  where s.TrackId == selectedTrackId
                                  orderby s.TechName
                                  select s).ToList();
              }
  
              return PartialView("_Technology", wrapper);
  
          }
  
          [HttpPost]
          public ActionResult SelectTechnology(int? selectedTechId)
          {
              CommonWrapper wrapper = new CommonWrapper();
              wrapper.subtopic = new List&lt;SubtopicsModel&gt;();
  
              if (selectedTechId.HasValue)
              {
                  wrapper.subtopic = (from s in CommonWrapper.GetSubtopics()
                                             where s.TechId == selectedTechId
                                             orderby s.SubtopicName
                                             select s).ToList();
              }
  
              return PartialView("_Subtopics", wrapper);
  
          }
  </code></pre>