0

I have a View with 2 Forms with two different submitt buttons. One form changes the profile and the other changes the password. So far I only have one @using (Html.BeginForm()) declaration. Do I need two since I have two forms. How do I route the button the appropriate HTTPPost controller action method?

Here are my buttons

Password:

Profile:

user1250264
  • 897
  • 1
  • 21
  • 54

2 Answers2

0

You can have as many Forms as you need and the route to be used will be specified on your Html.BeginForm that contains each submit button.

Check this already answered question on StackOverflow: asp.net MVC 4 multiple post via different forms

Community
  • 1
  • 1
juliano.net
  • 7,982
  • 13
  • 70
  • 164
0

BeginForm accept 2 parameters: the action name and the controller name:

Html.BeginForm("ActionName", "ControllerName", ...)

You can set the correct action/controller on each form.

ema
  • 5,668
  • 1
  • 25
  • 31