Shopping through STARKUPBD. Happy Shopping

Shopping through STARKUPBD. Happy Shopping

Handling MVC Submit Button Similar As AspDotNet Button

Category: ASPDOTNET MVC Post By: Admin Post Date: 10/2/2016

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 Comment
avatar
Anonymous
Comments
X


Twitter