You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$10
For Premium members:
This article shows the use of a FormCollection in the MVC architecture. Using the FomrCollection class we can capture the form's values within the controller.
This article shows the use of a FormCollection in the MVC architecture. Using the FomrCollection class we can capture the form's values within the controller. We know that there are various ways to collect data from a view to a collection, FomrCollection is one of them. We will implement a simple example of a FomrCollection shortly. To implement it we need to create a MVC application. Here is the view to create the HTML form element We are using a .aspx view in this application and a HTML helper class to generate HTML elements. If we look closely at the form element we will see that the form data will be submited for the “savedata” action defined within the “person” controller. Have a look at the following code.
When we run the application, we will get the following output. And when the Submit button is pressed, the form data will be submitted to the targeted action.
The savedata() action is taking an object of the FormCollection class. When we submit the form then all the control's information will be in the “form” object. Have a look at the following output.
Hands on ASP.NET GridView