I have 2 forms, each has 2 submit buttons.
One of my forms is "Create". In this form I use no hiddenfor object and 2 submit button like this:
<button type="submit" class="btn btn-success btn-sm" name="continueEditing" value="false">
<i class="fa fa-save"></i>
@GlobalRes.Save
</button>
<button type="submit" class="btn btn-success btn-sm" name="continueEditing" value="true">
<i class="fa fa-save"></i>
@GlobalRes.SaveAndContinue
</button>
and in server side my action signature is like this:
[HttpPost]
public ActionResult Create(CategoryCreateVm model, bool continueEditing)
{//}
Everything works fine, but the problem is when I try to use same script and same code in Edit action, I face error, which says parameter named continueEditing is null!
The only difference between the Create
and Edit
view is that I used a hidden for object in the Edit
view:
@Html.HiddenFor(x => x.Id)
What is wrong with this form that I am not able to send extra hidden values besides parameters using submit buttons? The note is that I have to use same action for both submits.