Interviews1 answer
How do you handle multiple submit buttons inside the single form in ASP.NET MVC ? Eg. @using (Html.BeginForm("Index", "Home", FormMethod.Post)) { button type="submit" id="btnApprove" value="Approve"> Approve button type="submit" id="btnReject" value="Reject"> Reject }
1 Answer
We can fetch the clicked button's value from the actionmethod Index as below.
public ActionResult Index(string btnValue)
{
if (btnValue == "Approve")
{
return "Approve Clieked";
}
else if (btnValue == "Reject")
{
return "Reject Clieked";
}
}
Manthan MakaniPosted Jun 5, 2018, 3:05 AM EDT

