Link to home
Start Free TrialLog in
Avatar of itnifl
itniflFlag for Norway

asked on

Submit all Razor forms on the page via Javascript/jQuery

I am using C# MVC with Razor.
I have a form tied to a model in a partial view that is rendered twice on a page, each with different model contents. They have each their save submit button:
<input type="submit" class="btn btn-primary" value="Save" />

Open in new window

This works perfectly. When pushing the button, the respective model in the respective form gets posted to the server and the server updates the changes.

Now I want a button that submits both forms at the same time, and that is not a part of the partialview that these forms consist of.
I was thinking some sort JavaScript / jQuery based method that gets fired and handles the whole thing.

Any suggestions?
ASKER CERTIFIED SOLUTION
Avatar of Camillia
Camillia
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of itnifl

ASKER

Yes, I guess that will work. I was hoping on some magic way to trigger all the submits at once so that I wouldn't have to write code to handle it myself :) but I guess I will have to step up to my laziness and get things done ;)