title: ASP.Net MVC Postback and Models
body: <p>This is mostly a follow-up to a comment in this issu, but I don't have enough reputation to comment ... </p>
  
  <p><a href="https://stackoverflow.com/questions/17458569/asp-net-mvc-postback-a-label-value-to-your-controller">ASP.Net MVC Postback a label value to your controller</a></p>
  
  <p>Let's say I have a simple model:</p>
  
  <pre><code>public class SimpleClass
  {
      public String Label { get; set; }
      public String FirstName { get; set; }
  }
  </code></pre>
  
  <p>Label is changed based on user/client so it can't be a DataAttribute. If when posted back processing problems occur, we need to redraw the entire page. This is the crux of the problem of the previous post. The accepted solution is to do this:</p>
  
  <pre><code>@Html.DisplayTextFor(model =&gt; model.Label)
  @Html.HiddenFor(model =&gt; model.Label)
  @Html.EditorFor(model =&gt; model.FirstName)
  </code></pre>
  
  <p>That makes sense in that it works. But our models are much more complicated and extensive. This method will result in a ton of hidden fields which seems like a very dirty solution.</p>
  
  <p>This brings me to JP's comment:</p>
  
  <p><a href="https://stackoverflow.com/questions/17458569/asp-net-mvc-postback-a-label-value-to-your-controller#comment25367453_17458569">ASP.Net MVC Postback a label value to your controller</a></p>
  
  <p>The solution there is to reload the model. But it's not just a reload, it's also a merge since you want to preserve any client-side data changes.</p>
  
  <pre><code>default: SimpleClass { Label="TheLabel", FirstName="Rob"}
  postedback: SimpleClass { Label="", FirstName="Steve" }
  we want: SimpleClass { Label="TheLabel", "FirstName="Steve" }
  </code></pre>
  
  <p>My question is does MVC have a good way to know what fields were postedback so it merges correctly? We would need to only merge postedback fields not blank properties.</p>
  
  <p>Or is it better to just ajaxify the entire postback and not do a form submit? This avoids all model reload issues on submit.</p>
  
  <h2>Update</h2>
  
  <p>To give Pablo credit I accepted his solution. To see my simple example of his solution, check Robert Harvey's comment in the Answers below: </p>
  
  <p><a href="https://stackoverflow.com/questions/27318811/asp-net-mvc-postback-and-models/27337044#27337044">ASP.Net MVC Postback and Models</a></p>