title: Passing data from View to Controller
body: <p>In an ASP.NET MVC application, I'm making logic for Admin to accept or reject new members. I'm showing a list of members and two buttons Accept and Reject, like this:</p>
  
  <pre><code>&lt;% foreach (var mm in (ViewData["pendingmembers"] as List&lt;MyMember&gt;)) %&gt;
  &lt;% { %&gt;
     &lt;tr&gt;&lt;td&gt;Username:&lt;%=mm.UserName %&gt;&lt;/td&gt;&lt;td&gt;
     &lt;tr&gt;&lt;td&gt;Firstname:&lt;%=mm.FirstName %&gt;&lt;/td&gt;&lt;td&gt;
     ...etc...
     &lt;tr&gt;
        &lt;td&gt;
        &lt;% using (Html.BeginForm("AcceptPendingUser", "Admin"))
        { %&gt;
            &lt;input type="submit" value="Accept" /&gt;
        &lt;% } %&gt;
        &lt;/td&gt;
        &lt;td&gt;
        &lt;% using (Html.BeginForm("RejectPendingUser", "Admin"))
        { %&gt;
          &lt;input type="submit" value="Reject" /&gt;
        &lt;% } %&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
  &lt;% } %&gt;
  </code></pre>
  
  <p>So, the list of pending member data is in a list of MyMember-objects. Each MyMember object will be printed out member and two buttons are setup for the admin to either accept or reject a pending member. </p>
  
  <p>Then, in the controller I'm separating the handling of those two input fields/forms, like this:</p>
  
  <pre><code>public ActionResult AcceptPendingUser()
  {
     // TODO: Add code to save user into DB and send welcome email.
     return RedirectToAction("Index");
  }
  
  public ActionResult RejectPendingUser()
  {
     // TODO: Add code to remove user from PendingUsers list and send rejection email.
     return RedirectToAction("Index");
  }
  </code></pre>
  
  <p>I would like to directly get the object next to the button the user pressed.
  How can I send the MyMember object from the View to the controller? 
  Or how do I send perhaps a numeric index with button press? Maybe with a hidden field?</p>