Monday, August 15, 2011
Multiple Submit Buttons in ASP.NET MVC
In Razor view
@using (Html.BeginForm())
{
<p>
<input type="submit" name="AddButton" value="Add" />
<input type="submit" name = "RemoveButton" value="Remove" />
</p>
}
[HttpPost]
public ActionResult TwoButtonss(string AddButton, string RemoveButton)
{
var AddButtonClick = AddButton ?? RemoveButton;
return View();
}
Reference:
http://www.dotnetcurry.com/ShowArticle.aspx?ID=705
@using (Html.BeginForm())
{
<p>
<input type="submit" name="AddButton" value="Add" />
<input type="submit" name = "RemoveButton" value="Remove" />
</p>
}
In Controller:
public ActionResult TwoButtonss(string AddButton, string RemoveButton)
{
var AddButtonClick = AddButton ?? RemoveButton;
return View();
}
Reference:
http://www.dotnetcurry.com/ShowArticle.aspx?ID=705
Subscribe to:
Posts (Atom)