title: How to auto-populate specific fields when using @Html.EditorForModel() to build a form?
body: <p>I have users fill out their profile information somewhere on my site using the AspNetSqlProfileProvider that came with the IDE.</p>
  
  <p>I allow my users to edit their profile at any time by going to the edit profile page where the form to edit their profile auto-populates.  I currently do this by using ViewBag to send each individual part of a user's profile from my controller to the view (address and city for example):</p>
  
  <p>Controller get:</p>
  
  <pre><code>ViewBag.address = CustomProfile.GetUserProfile(User.Identity.Name).Address;
  ViewBag.city = CustomProfile.GetUserProfile(User.Identity.Name).City;
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>    &lt;div class="editor-field"&gt;
          @Html.TextBox("Address", (string)ViewBag.address)
      &lt;/div&gt;
  
      &lt;div class="editor-field"&gt;
          @Html.TextBox("City", (string)ViewBag.city)
      &lt;/div&gt;
  </code></pre>
  
  <p>Controller post:</p>
  
  <pre><code>    public ActionResult ChangeProfile( FormCollection favorites )
      {
          CustomProfile profile = CustomProfile.GetUserProfile();
          profile.Address = favorites["Address"];
          profile.City = favorites["City"];
          profile.Save();
          return RedirectToAction("Profile");
      }
  </code></pre>
  
  <p>The above works fine for editing profiles, it is very smooth from my user's perspective (although, from reading questions/answers online it appears I should be using a ViewModel, not exactly sure how to make the transition - have been failing).  </p>
  
  <p>When my user's go to 'checkout' from the website (they've been shopping), they are presented with a screen that allows them to input final information that allows them to make their purchase.  Let's call this the, "Order Page."  These details include name, address, credit card info, etc.  Some of these pieces of information are the same as the information within the profile page of the website.</p>
  
  <p>I want to be able to auto-populate some of the details in this Order Page (name, address) while leaving some of the fields blank (credit card - so the user has to fill these details in each time they visit the order page).</p>
  
  <p>The way the Order page works is as the <a href="http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-9" rel="nofollow" title="MVC Music Store Order Process">MVC Store Tutorial describes</a>.  When the Order Page is displayed it displays the form using:</p>
  
  <pre><code>@Html.EditorForModel()
  </code></pre>
  
  <p>Which is great and allows you to edit the details specified within the Order model and will allow for the data verification stuff (name is required, address is required, credit card has to be numbers, email is properly formatted, etc), but I cannot figure out how to populate specific fields within this Order Page with details from my user's profile.</p>
  
  <p>I have attempted building a new ViewModel that uses just the information contained within my profile, but I do not have a clear grasp of what is needed because I am not getting the end-result I am desiring.</p>
  
  <p>I have considered using just the Order Model as my Profile information, but that is not sufficient because I want to have different information available in both.</p>
  
  <p>I have considered using the Profile information as the Order Model, but I want my users to have the flexibility to store profile information separately from whatever information they use to actually place orders.</p>
  
  <p><strong>I think what I need to know specifically to fix my problem is how do I auto-populate specific fields while using "@Html.EditorForModel()" ?</strong></p>
  
  <p>Any other help with my overall situation would be great, I am very open to any advice that would simplify my flow (it feels like I am making it harder on myself than I need to, and I am at a point where collaboration would feel like a breath of fresh air).</p>