How can you handle multiple submit buttons? (ASP.NET MVC Interview Questions)
- By Shiv Prasad Koirala in ASP.NET
- Dec 23rd, 2014
Let us try to understand what the interviewer is asking.
If you have two submit buttons as shown in the below code and you want that when end user click first submit button, "X" action should fire and in the other submit button click "Y" action should fire. What is the best way to achieve the same?.
The first way is by creating two form tags and every submit button goes in to those individual form tags as shown in the below code. So if you click on submit button "sub1" it will post to "Action1" and if the end user clicks on "sub2" it will post to "Action2".
Do not forget to download our 100 ASP.NET MVC Interview question ebook
If you are completely new to ASP.NET MVC you can start with below free youtube video which teaches MVC 5 from scratch.
Shiv Prasad Koirala
Visit us @ www.questpond.com or call us at 022-66752917... read more