You can handle events by implementing event handlers in your razor code behind file. For example. This is a button in my test razor page
<form asp-page-handler="PendTop" method="post">
<button class="btn btn-default">Edit</button>
</form>
Notice the attribute "asp-page-handler" this is an attribute that comes with the razor technology. You assign the name of your EventHandler to execute with this attribute. In my case it is PendTop.
There is a naming convention that is used within the razor framework when calling your EventHandler. Its based on prepending the letters 'On' before the name of the method.
So for my Event handler I have the method
public void OnPostPendTop(string query)
{
}
Using this will allow you to specify the event handler to be executed in a razor page code behind file. In this scenario the parameter name "query" will be null because I have not specified any parameter value to be sent, but you can change that.