Mvc4 How to use multiple button in one mvc4 page
Introduction : In mvc4 when we need to use multiple button in one view or page then need to specify the which controller and view action method can use to submit the form data. here explain how to identify which button can used the submit data.
Step 1:
<input type="submit" value="Save" />
In above code we can use single submit button and not need to specify controller action method
Step 2:
But when we use multiple submit button it need to specify which controller can used to submit form data here below explain how to work it.
<input type="submit" formaction="/ABC/Add" value="Save" />
<input type="submit" formaction="/ABC/Delete" value="Cancel" />
<input type="submit" formaction="/ABC/Delete" value="Cancel" />
Here, Formaction="/ABC/Add" here "ABC" is controller and "Add" is method to add form data
and formaction="/ABC/Delete" here "Delete" is action method to delete data from submit button2
Sign up here with your email
ConversionConversion EmoticonEmoticon