I need to have multiple buttons on same view, but for some reason it doesn't work. I did already looked at the same questions but I haven't got a solution.
How do I know which button is performed in the view?
View:
<%@ Page Title="" Language="C#" MasterPageFile="~/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<LIASWeb.Models.Publication>" %>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>NewPublication</h2>
    <% using (Html.BeginForm())
       { %>
    <div>
        <fieldset>
            <p>
                <label for="Name">Naam:</label>
                <%: Html.TextBoxFor(m => Model.nmPublication) %>
            </p>
            <p>
                 <%: Html.TextBox("Search", "type naam")%>
                <input type="submit" name="btnSearch" value="Zoeken" />
            </p>
            <p>
                <input type="submit" name="btnSave" value="Opslaan" />
            </p>
        </fieldset>
    </div>
    <% } %>
</asp:Content>
Controller:
public class PublicationController : Controller
{
    private Repository repository = null;
    public PublicationController()
    {
        repository = new Repository();
    }
    public ActionResult NewPublication(String button)
    {
        if (button == "btnSave")
            // perform save action
            if (button == "btnSearch")
            // perform save action
        return View();
    }
    public ActionResult Index()
    {
        IEnumerable<Publication> model = repository.Publications;
        return View(model);
}
Routings:
public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    routes.MapRoute(
        name: "Default",
        url: "{controller}/{action}/{id}",
        defaults: new { controller = "Publication", action = "Index", id = UrlParameter.Optional }
        );
}
 
     
     
     
     
     
     
    