title: Razor Pages action from input button
body: <p>I'm trying to understand how Razor pages work, as well as .Net Core, by creating a small web application and I'm stuck on how to handle the button action within a form. I'm used to the MVC type of process (from when I first tried web apps 5 years ago) where the button would have a onClick action that could be accessed from the code behind but it seems like that's not the same with a Razor page (unless I'm just not seeing it). I have a basic form like this</p>
  
  <pre><code>&lt;form method="post"&gt;
  &lt;fieldset&gt;
  &lt;input type="text" value="" placeholder="user name"/&gt;
  &lt;input type="password" value="" placeholder="password"/&gt;
  &lt;input type="button" value="Submit" id="submitButton"/&gt;
  &lt;/fieldset&gt;
  </code></pre>
  
  <p>So what I'm trying to achieve is when the button is pressed an action in the .cs file is called that will perform a couple different operations (like calling an API, getting a result and then depending on result route to a different page) but even if I add an "onClick" to the button I can't figure out how to hook it up to the code behind. I've seen various answers, most using models and a database but since that's not the same as what I'm doing those examples haven't helped. </p>