Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This post is not going to answer to Coppermill, because he have been answered long time ago. My post will be helpful for who will seeking for solution like this. First of all , I have to say " WDuffy's solution is totally correct" and it works fine, but my solution (not actually mine) will be used in other elements and it makes the presentation layer more independent from controller (because your controller depend on "value" which is used for showing label of the button, this feature is important for other languages.). <br/> Here is my solution, give them different names , Like:<br/></p> <pre><code> &lt;/p&gt; &lt;input type="submit" name="buttonSave" value="Save"/&gt; &lt;input type="submit" name="buttonProcess" value="Process"/&gt; &lt;input type="submit" name="buttonCancel" value="Process"/&gt; &lt;/p&gt; </code></pre> <p>`<br/> And you must specify the names of buttons as arguments in the action like below:<br></p> <pre><code> public ActionResult Register(string buttonSave, string buttonProcess, string buttonCancel){if (buttonSave!= null) {//save is pressed } if (buttonProcess!= null) {//Process is pressed } if (buttonCancel!= null) {//Cancel is pressed } </code></pre> <p><br/> when user submits the page using one of the buttons, only one of the arguments will have value. I guess this will be helpful for others. <br/> <strong>Update</strong> <br/> This answer is quite old and I actually reconsider my opinion . maybe above solution is good for situation which passing parameter to model's properties. don't bother yourselves and take best solution for your project.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload