FormCollection读取表单数据

view  数据传递到controller   formcollection 是一个集合提交form 对象的集合

例如控制器获取view 表单数据

[AcceptVerbs(HttpVerbs.Post)]
       public ActionResult FormCollection(FormCollection formCollection)
       {
           Person person = new Person();
           person.FirstName = formCollection["FirstName"];
           person.LastName = formCollection["LastName"];
           return View(person);
       }

还有这种

public ActionResult List(FormCollection form)
{
int? index = int.Parse(form.GetValue("pageindex").AttemptedValue);
}

比较复杂一点

原文地址:https://www.cnblogs.com/dh2014/p/4840458.html