I have a form with multiple buttons. On post, I would like to get the id of the button that was actually pressed.
So for instance if button #2 is pressed, I need to be able to access the id for this button and then delete itemid 2:
<button name="button" value="DeletePollAnswer" id="Delete1">Delete</button>
<button name="button" value="DeletePollAnswer" id="Delete2">Delete</button>
Is this possible? How would you do that in the controler?
Thanks
It sounds like you are going around this the wrong way, generally when forms are submitted it is in key value pairs, with the key being the element
nameattribute and the value being the elementvalueattribute. If you need to differentiate I would do it there.IE:
Also with MVC it is likely you might want links that would want to call a specific action or pass data to a specific action in which case the an anchor with a an action link should be invoking the specific action directly.
IE:
Of course in that example all the names are completely gibberish, you would want to replace with your controller/action/params etc.