over 5 years ago
FormCollection class in MVC is used to send or retrieve form data from one view to another.
Using this you can access every element of your form means all the controls
Form collection is the collection of all the object that we use in our view so while retrieving any control property we can get it from the FormCollection class.
/* To post all the details from the view into the Edit action */
public ActionResult Edit(FormCollection frmobj)
Details obj = new Details();
Database dbobj = new Database();
/* To retrieve object values from the view */
obj.Name = frmobj["Name"];
obj.dob = frmobj["dob"];
string gethobbies = Convert.ToString(frmobj["chkHobbies"]);
HTTPPost is the way to send data from one view to another and we will access all the elements of the forms by its name.
In this example the user details like name and date of birth is first posted from the view and then passed into the action and then using the FormCollection class the values is being accessed.
Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome. For more information, see Chrome and NPAPI (blog.chromium.org).
Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
Chrome Version Support
Are you sure, you want to delete this comment?
Terms of Service
| © copyright 2021 FindNerd.com. All rights reserved.
Sign up using