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);
}

比较复杂一点

posted @ 2015-09-26 11:13  飞猪.net  阅读(703)  评论(0编辑  收藏  举报