title: Passing hidden value to controller (asp.netmvc)
body: <p>Trying to pass a value with Ajax.Beginform but not working for some reason.</p>
  
  <p>What I’m doing:</p>
  
  <ol>
  <li><p>I’m making an ajax call which returns an id and replaces a hidden element.</p>
  
  <p><code>Ajax: Ajax.BeginForm("Action1",      "Controller1", new AjaxOptions { InsertionMode<br>
   = InsertionMode.Replace, UpdateTargetId = "pageId" })</code></p></li>
  </ol>
  
  <p>Hidden Element (which is outside of the above <code>Ajax.BeginForm</code>):   </p>
  
  <pre><code> &lt;input type="hidden" name="pageId" id="pageId" value=""/&gt;
  </code></pre>
  
  <ol start="2">
  <li><p>Now, I want to use that pageId (in the hidden value) and pass it to another action, using another Ajax.BeginForm.</p>
  
  <p><code>Ajax.BeginForm("Action2", "Controller1”))
              {
                  &lt;input type="hidden" name="pageId" id="pageId" value=""/&gt;
                  &lt;input type="submit" /&gt;
              }</code>   </p></li>
  <li><p>The controller Action2 looks like this:</p>
  
  <pre><code>     public void Action2(string pageId)
       {
  
       }
  </code></pre>
  
  <p>But this is not working obviously. What are your suggestions?</p></li>
  </ol>