MVC razor form with multiple different submit buttons?

前端 未结 13 1995
-上瘾入骨i
-上瘾入骨i 2020-12-04 12:59

A Razor view has 3 buttons inside a form. All button\'s actions will need form values which are basically values coming input fields.

Every time I click any of butto

13条回答
  •  心在旅途
    2020-12-04 13:37

    You could also try this:

    
    
    

    Then in your default function you call the functions you want:

    if( Request.Form["submitbutton1"] != null)
    {
        // Code for function 1
    }
    else if(Request.Form["submitButton2"] != null )
    {
        // code for function 2
    }
    

提交回复
热议问题