title: How does one get the value of a button click in ASP.NET Core MVC?
body: <p>I am trying to understand how the connection between a controller and a view works. I have set up four buttons with the tag <code>asp-action</code> expecting it to allow me to implement a method with the name <code>check</code></p>
  <pre><code>&lt;table style=&quot;width: 100%; margin-bottom: 25px&quot;&gt;
      &lt;tr&gt;
          &lt;td&gt;
              &lt;button name=&quot;button&quot; style=&quot;background-color: transparent; color: yellow&quot; 
                      type=&quot;button&quot; value=&quot;cph&quot; asp-action=&quot;check&quot;&gt;København&lt;/button&gt;
          &lt;/td&gt;
          &lt;td&gt;
              &lt;button style=&quot;background-color: transparent; color: yellow&quot; type=&quot;button&quot; value=&quot;odense&quot; asp-action=&quot;check&quot;&gt;Odense&lt;/button&gt;
          &lt;/td&gt;
          &lt;td&gt;
              &lt;button style=&quot;background-color: transparent; color: yellow&quot; type=&quot;button&quot; value=&quot;aarhus&quot; asp-action=&quot;check&quot;&gt;Århus&lt;/button&gt;
          &lt;/td&gt;
          &lt;td&gt;
              &lt;button style=&quot;background-color: transparent; color: yellow&quot; type=&quot;button&quot; value=&quot;aalborg&quot; asp-action=&quot;check&quot;&gt;Aalborg&lt;/button&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  <p>I tried to print the value of the button</p>
  <pre><code>public IActionResult check(string button)
  {
      Console.WriteLine(button);
      return View();
  }
  </code></pre>
  <p>However, it does never print anything, nor does it break on the method. What I would like to achieve is just the value. I would prefer just passing the value and do nothing e.g.</p>
  <pre><code>public striing check(string button)
  {
      return button;
  }
  </code></pre>
  <p>EDIT:
  I tried following this <a href="https://www.youtube.com/watch?v=2nOieuwix2A" rel="nofollow noreferrer">tutorial</a></p>