1.通过路由中的配置的参数名字直接接收(要求:两者同名)
routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Stu", action = "Index", id = UrlParameter.Optional }
            );
public ActionResult Del(int id)

{...}


2.通过模型绑定(要求表单中标签的Name属性的值和实体模型的属性一致)
public ActionResult Edit(Models.Student s)//模型绑定

{....}


3.通过原始的Request.QueryString和Request.Form


4.通过FormCollection
public ActionResult Edit(FormCollection form)
{
form[""]....
}

版权声明:本文为博主原创文章,未经博主允许不得转载。

 

相关文章:

  • 2022-12-23
  • 2021-11-03
  • 2021-08-18
  • 2022-12-23
  • 2022-02-18
  • 2022-12-23
猜你喜欢
  • 2021-12-14
  • 2022-12-23
  • 2021-10-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-08
相关资源
相似解决方案