title: MVC 3 pass model from view to controller without using Html form (submit) or JSON
body: <p>I have the following scenario for a web application:</p>
  
  <p>A user registers a company, for this I load a company Create view.</p>
  
  <p>Inside the create page, I have a dropdown list of Contact Persons for the company. Initially this list is empty, the user can click on a create button to create a new address.</p>
  
  <p>This loads a partial view (as JQuery popup) for the Contact person. After the user created a new Contact person, the view returns to the Company registration view. The Company registration view must refresh with the newly added Contact Person in the dropdown box. It must also keep any data already entered.</p>
  
  <p>The following is the same scenario as mine, but due to design constraints I cannot use JSON. <a href="https://stackoverflow.com/questions/11588426/how-to-pass-the-full-model-from-view-to-controller-via-jquery-in-a-mvc-c-sharp-a">How to pass the full Model from view to controller via jquery in a MVC c# application</a></p>
  
  <p>MY QUESTION: Is there any way I can store the entire model in the view into Session, to use in my controller? </p>
  
  <p>I tried the following:</p>
  
  <pre><code>        &lt;div class="editor-label"&gt;
              @Html.LabelFor(model =&gt; model.CompanyName)
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.EditorFor(model =&gt; model.CompanyName)
              @Html.ValidationMessageFor(model =&gt; model.CompanyName)
  
              @Session.Add("CompanyName",Model.CompanyName)
          &lt;/div&gt;
  </code></pre>
  
  <p>As this is void, it does not return a value, and cannot render.</p>
  
  <p>So I tried passing the model as a parameter to the controller, but it keeps being null:</p>
  
  <pre><code>public ActionResult CreateContactPerson(ManagementAgencyViewModel viewModel)
      {
  
          if(HttpContext.Session != null)
              HttpContext.Session.Add("MaObject",viewModel);
  
          return RedirectToAction("Create", "ContactPersons");
      }
  </code></pre>
  
  <p>Using an actionLink to call the Company Controller named "ManagementAgencies":</p>
  
  <pre><code>    @Html.ActionLink(@ViewResources.Link_New_ContactPerson, "CreateContactPerson",           "ManagementAgencies", null, new { @class = "openDialog  ui-button ui-state-default ui-corner-all", data_dialog_id = "createDialog", data_dialog_title = @ViewResources.DialogTitle_CreateNew })
  </code></pre>
  
  <p>Is there any alternatives to storing in Session, WITHOUT using hidden fields or JSON?
  If so, what is the correct way to store model values into session from within the view?</p>