To do this, we have to figure out which button was clicked. This can be done in the following way:
Make two buttons with the same “name” but different “value”
e.g
<input type="submit" id="GetResults" name="SubmitButton" value="Apply" />
<input type="submit" id="UpdateResults" name="SubmitButton" value="Inform" />
In the controller action, add the following input parameter (string SubmitButton)
Inside the controller action, the value of the variable “SubmitButton” will either be “Apply” or “Inform” depending upon which submit button was clicked.
After this, a simple “if” condition such as the one given below will do the job:
If(SubmitButton == "Apply")
{
Do this
}
Else if (SubmitButton == "Inform")
{
Do that
}
No comments:
Post a Comment