This post is about how to work with multiple submit buttons in aspnet core form. Sometimes you have to use multiple submit buttons in a single form in ASP.NET Core. In HTML forms we can do this with the help of
formaction attribute. But this attribute will not work in ASP.NET Core. In ASP.NET Core you need to use
asp-action attribute instead.
Here is the code.
Please note there is no
asp-action attribute added for the
Form element. And based on the Form method we need to create the action methods in the controller. And it is rendered in the page like this.
As expected, it will convert the
formaction attribute of the button.
Happy Programming :)