Posts

Showing posts with the label FormCollection in MVC

Understand FormCollection in MVC Controller

Image
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. <% @   Page   Language ="C#"   Inherits ="System.Web.Mvc.ViewPage<MVC_Test.Models.person>"   %> <! DOCTYPE   html > < html > < head   runat ="server">      < meta   name ="viewport"   content ="width=device-width"   />      < title > Index </ title > </ head > < body > ...