title: Create (not read) field values into a new view in C# MVC
body: <p>I've looked, tried several different solutions and haven't found anything that works (at least, not something with an example close enough to what I want for me to follow). I'm sure I'm missing something that would be a simple thing to a more experienced coder. Help? </p>
  
  <p>I have a Model called Residents. It includes ResidentID, PFName, PLName. I have a controller for Residents. I have CRUD views for Residents. All working just fine. </p>
  
  <p>I have a Model called Logs. It includes LogID, ResidentID, Comments. I have a controller for Logs. I have CRUD views for Logs. All working just fine. </p>
  
  <p>I can display all the log entries for a Resident. Works fine. After a Log entry has been created, I can display the PFName using the method</p>
  
  <pre><code>@Html.DisplayFor(model =&gt; model.Resident.PFName) 
  </code></pre>
  
  <p><strong>Next, I want to Create a new log entry for a selected Resident.</strong> </p>
  
  <p>That's where I'm having the problem. I would like the "Create" view (for the Log) to display the ResidentFName and ResidentLName of the selected resident, not the ResidentID. </p>
  
  <p>A this point, from the Details view for a Resident, I have a CreateLog link. </p>
  
  <pre><code>@Html.ActionLink("New Log Entry", "../Log/Create", new { @ResidentID = Model.ResidentID})
  </code></pre>
  
  <p>This (likely not the best way) gives me a URL with the value of the selected ID</p>
  
  <pre><code>http://localhost:999/Log/Create?ResidentID=1
  </code></pre>
  
  <p>The value for the ResidentID is correct; it changes depending on which Resident is selected. </p>
  
  <p>This value is correctly entered </p>
  
  <pre><code>        @Html.TextBoxFor(model =&gt; model.ResidentID)
  </code></pre>
  
  <p>on the new CreateLog page using the Log Controller Create action. </p>
  
  <pre><code>public ActionResult Create(int ResidentID)
  </code></pre>
  
  <p>I plan to hide the ResidentID TextBox so the user doesn't see it. It seems I have to make it available in the form to be able create a new log entry. </p>
  
  <p>The CreateLog form currently works as I have it now. I can create a log entry and verify that entry has been correctly recorded for the Resident. </p>
  
  <p><strong>But, I would like the form to display the PFName and PLName for the Resident so the user has visible feedback for which Resident was selected.</strong> </p>
  
  <p>I believe that the related data (PFName and PLName) I want has to be passed to the CreateLog form .... somehow. I can't get it from the form. </p>
  
  <p>Since there's only the unsaved entry for ResidentID, I can't use the value from the CreateLog form it to display related data. As mentioned, for the Lists, there is no such problem. It's only for CreateLog. </p>
  
  <p>I've tried adding the data to the URL. Not working. I've tried setting the strings in the Controller (and the URL). Not working. I've looked at setting a cookie, but haven't ever done that so not sure what to set or where to put it or how to get the values from it. I've looked at setting a variable in the controller ... (have that working to display drop down lists, but a list to select from is not what I need -- I want the matching values from the related table). </p>
  
  <pre><code>Log.LogID(PK, Identity)
  Log.ResidentID(FK)
  Resident.PFName
  Resident.PLName
  </code></pre>
  
  <p>I can directly create a view with these tables/fields in my SQLDB and update it. </p>