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?

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.