Razor Pages
ASP.NET Core/MVC: Adding a Button to a Razor View Page that Returns a Method On-Click
I needed to add a button in my ASP.NET Core MVC web application that on-click would start a method that would return a list of items scraped from another website.
Something like this:
The code I got to work for doing so is:
<button type="button" id="startButton"
onclick="location.href='@Url.Action('List', 'ArbitrageScraper')'">
Start Scrape
</button>
This code resides inside of the View for your controller. My button …
Read More…