0

I have a controller with this method

    [HttpPost]
    public ActionResult AssociateCaseDetails(string btnSubmit, string navigate)
    {
    ................................
    ................................
    }

In the view i had an input like

<input type="submit" class="backdetails" value="BACK" name="btnSubmit"  />

When i clicked on that button the btnSubmit value was BACK, so i thought of creating a similar input which will call that method

<input type="submit" class="submit" value="SAVE" name="btnChangeStatus"  />

When i click this the AssociateCaseDetails is getting called but the btnSubmit is having null as value What have i done wrong here?

Vignesh Subramanian
  • 7,161
  • 14
  • 87
  • 150

1 Answers1

2

Your post method has a parameter named btnSubmit, so the first submit button works because it has the attribute name="btnSubmit". The second does not work because it has name="btnChangeStatus". Change the second button to have the same name attribute (name="btnSubmit") so that it will be bound to your parameter.