title: Pass value from partial to controller
body: <p>I've got a page that has an area for partial views, like this:</p>
  
  <p><img src="https://i.stack.imgur.com/WtYVo.png" alt="enter image description here"></p>
  
  <p>The partial view changes depending on which section the user is in, through a tab menu. For each tab chosen, the partial view changes. Every partial view shown there has fields to edit. The buttons <code>Save</code> and <code>Cancel</code> are always the same, contained in the surrounding view.</p>
  
  <p>When the user presses <code>Save</code>, I want to catch the inserted values, which I did in other views through:</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;input type="text" name="phoneNumber"&gt;
  </code></pre>
  
  <p><strong>C#</strong></p>
  
  <pre><code>string phoneNumber = Request["phoneNumber"].ToString();
  </code></pre>
  
  <p>But here, I keep getting a null exception when the debugger hits the above C# line.</p>
  
  <p>How can I pass a value from a partial view to the controller, contained in an <code>input</code>?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Here's my code: the input in the view (the button)</p>
  
  <pre><code>&lt;input type="submit" name="save" value="Save" onclick="location.href='@Url.Action("SaveChanges", "Config")'"/&gt;
  </code></pre>
  
  <p>And the <code>SaveChanges</code> method, in the controller:</p>
  
  <pre><code> public ActionResult SaveChanges()
          {
              string phoneNumber = Request["phoneNumber"].ToString();
              ...
  </code></pre>
  
  <p><strong>Also</strong>, I've tried this for my login form and it works fine:</p>
  
  <pre><code>&lt;form method="get" action="../Main/Index"&gt;
      &lt;p&gt;
          &lt;input type="text" name="username" maxlength="30"&gt;&lt;/p&gt;
      &lt;p&gt;
          &lt;input type="password" name="password" maxlength="25"&gt;&lt;/p&gt;
  
      &lt;p class="submit"&gt;
          &lt;input type="submit" name="commit" value="Login"&gt;&lt;/p&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>And the controller (MainController)</p>
  
  <pre><code>public ActionResult Index()
          {
              getCredentials();
  ...
  
   public void getCredentials()
          {
  
              if (Request["username"] != null &amp;&amp; Request["password"] != null)
  ...
  return View();
  </code></pre>