Handling MVC Submit Button Similar As AspDotNet Button

To detect multiple button event separately like ASP.NET button event then here is a mostly clean attribute-based solution for the multiple submit button issue. You decorate an action method in a controller with the ActionNameSelectorAttribute (or a subclass), ASP.NET MVC will use this attribute to determine which action method to call.

In View
Just Create multiple submit type button in view in form tag



In Controller
Controller must contains out custom created attribute



Attribute Class

Main Part is here. Here When applying the SubmitButtonSelector Attribute to an action method, ASP.NET MVC will come and call the IsValidName method. Then all ok and work as our needed.

Leave a Reply

Your email address will not be published. Required fields are marked *