title: partialview model updating parent view
body: <p>not sure how to word this correctly..
  so i have a view which has a strongly typed viewmodel as:</p>
  
  <pre><code>class MyViewModel
  {
      public string MyName get; set;
      public string DateOfBirth get; set;
      public Address MyAddress get; set;
  }
  
  class Address
  {
      public string Street get; set;
      etc...
  }
  </code></pre>
  
  <p>i'm loading the inital view with MyViewModel and using the following to display a partial view to load the address (this way so the address input can be reused).</p>
  
  <p>the view contains a dropdown list with a list of user names in, selecting a value in the drop down calls a ajax .change function which does the following:</p>
  
  <pre><code>$.get('/User/DisplayAddress/', {'selection': selection }, function (html) {
  
  $('#addressBlock').html(html);
  
  });
  </code></pre>
  
  <p>that all works great..and the html is loaded in.. however, the viewmodel and the address is now disconnected. so when i submit my page, the MyAddress from the ViewModel now contains a null.</p>
  
  <p>How should i be correctly doing this in mvc2 / ajax?</p>
  
  <p>another approach i used was to use the '<code>&lt;% RenderPartial("viewname", Model.MyAddress); %&gt;</code>
  which works but i still have to return the data in json and add the values to the fields manually in a java function - this works well.. but its very messy when MyAddress field my contain several fields and to hardcode adding the value into the input fields just looks horrible.</p>