ASP.NET MVC Dynamic Forms

Andrei picture Andrei · Jun 21, 2013 · Viewed 42.8k times · Source

Can anyone suggest a good way to develope dynamic forms with ASP.NET MVC?

I have cascading dropdowns on the page (options in the dropdown depends on the value, selected in the previous dropdown).

All the values come from the database.

How can I implement such behavior using ASP.NET MVC?

Of course I'd like to receive all the values in the controller when I submit my form.

Answer

Roman Bats picture Roman Bats · Mar 25, 2017

You can use FormCollection as a parameter to receive all data that comes from the form:

[HttpPost]
public ActionResult ActionName(FormCollection collection)
{
    //collection["inputName"];
}