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>
}




In Controller:

        [HttpPost]
        public ActionResult TwoButtonss(string AddButton, string RemoveButton)
        {
            var AddButtonClick = AddButton ?? RemoveButton;
            return View();
        }



Reference:
http://www.dotnetcurry.com/ShowArticle.aspx?ID=705

No comments:

Post a Comment