Let's say I have an asp.net mvc application. It contains a view with two html forms:

@using(Html.BeginForm("act", "ctrl", FormMethod.Post, new { @id = "form1" })) {
    @Html.TextBox("name");
    ...
}

@using(Html.BeginForm("act2", "ctrl2", FormMethod.Post, new { @id = "form2" })) {
    @Html.TextBox("name2");
    ...
}

And a controller:

[HttpPost]
public ActionResult Act() {
  //...
}

I agree, it's a bit strange, but is it possible to get information about the form id in public ActionResult Act() when the form is submitted? May I can use FormContext or ViewContext to achieve it?

Related posts

Recent Viewed