Some issues:
- You probably want your
<button>
withtype="submit"
, otherwise the form will not be submitted, and the button will do nothing. See also: MDN - Button Type Html.BeginForm("Professional", "Sum")
should beHtml.BeginForm("Sum", "Professional")
- The controller is the second argument.
Html.BeginForm("Sum")
would also work here, because this is the current controller.- The inputs should have
name="nro1"
, notid
- it is the name that is being submitted. - No need for semicolon after
@ViewBag.SumResult
(though that isn't a bug). - I'm not sure what
data-toggle="button"
is doing here.
Note that you are not "calling a Controller from a View" - you are submitting a form, which starts a new Controller-View cycle. Html.Action
can do something similar, but that is not what you're trying to do here.
I'd also take this opportunity and recommend against using ViewBag
- Use a strongly typed view model instead