title: ActionLink in Table MVC
body: <p><em>Edit: I have read and implemented the method oulined in <a href="http://www.itorian.com/2013/02/ajaxactionlink-and-htmlactionlink-in-mvc.html" rel="nofollow">this article</a> but this does not work.</em></p>
  
  <p>I have the following table which is populated correctly.</p>
  
  <pre><code>&lt;table class="table"&gt;
     &lt;tr&gt;
         &lt;th&gt;Product&lt;/th&gt;
         &lt;th&gt;File Name&lt;/th&gt;
         &lt;th&gt;Release Date&lt;/th&gt;
         &lt;th&gt;Size&lt;/th&gt;
         &lt;th&gt;&lt;/th&gt;
     &lt;/tr&gt;
     @{
         if (Model != null)
         {
             foreach (var item in Model.Uploads)
             {
                 &lt;tr&gt;
                     &lt;td&gt;@Html.DisplayFor(modelItem =&gt; item.Product)&lt;/td&gt;
                     &lt;td&gt;@Html.DisplayFor(modelItem =&gt; item.DisplayName)&lt;/td&gt;
                     &lt;td&gt;@Html.DisplayFor(modelItem =&gt; item.ReleaseDate)&lt;/td&gt;
                     &lt;td&gt;@Html.DisplayFor(modelItem =&gt; item.Size)&lt;/td&gt;
                     &lt;td&gt;@Html.ActionLink("Delete File", "Upload", "Tools", new { id = item.DisplayName }, null)&lt;/td&gt;
                 &lt;/tr&gt;
             }
         }
     }
  &lt;/table&gt;
  </code></pre>
  
  <p>I also have a controller with the action </p>
  
  <pre><code>[HttpPost]
  [AllowAnonymous]
  [ValidateAntiForgeryToken]
  public async Task&lt;ActionResult&gt; DeleteUser(
      AdministratorViewModel model, string userName)
  {
      // Do amazing stuff...
      return Index();
  }
  </code></pre>
  
  <p>I want to pass to this action the username that was selected for deletion. I thought I could achive this with <code>@Html.ActionLink</code> as above, but this is not the way to go. </p>
  
  <p><strong>How can I pass the selected username that was selected to my action method?</strong></p>
  
  <p>Thanks for your time.</p>
  
  <hr>
  
  <p><em>Edit:</em> changing the Ajax code to the following (using <code>Index</code> as the called method) </p>
  
  <pre><code>@Ajax.ActionLink(
      "Remove",
      "Index", 
      "Tools",
      new
      {
          model = item,
          userName = item.UserName
      },
      new AjaxOptions
      {
          InsertionMode = InsertionMode.Replace,
          HttpMethod = "POST"
      })
  </code></pre>
  
  <p>and changed the name of the <code>DeleteUser(AdministratorViewModel model, string userName)</code> method to <code>Index(AdministratorViewModel model, string userName)</code>. This now fires the <code>Index</code> method in the <code>ToolsController</code>. But the method called is the NON-POST attributed method(!?) so I now have two questions:</p>
  
  <ol>
  <li>How can it be calling the method not marked with <code>[HttpPost]</code> attribute?</li>
  <li>Why can I call the <code>DeleteUser</code> method using Ben Griffiths' answer below?</li>
  <li>How can I call my <code>DeleteUser</code> method in the Tools controller and pass in the model and the name of the user I want to delete?</li>
  </ol>
  
  <p>Thanks for your time.</p>