1.使用MVC默认Model Binder
[AcceptVerbs("POST")]
public ActionResult Edit(Product product)
2.使用FormCollection然后自己然后手工绑定
[AcceptVerbs("POST")]
public ActionResult Edit(FormCollection form)
3.使用UpdateModel只绑定指定的属性
UpdateModel(product, new[] { "ProductName", "UnitPrice", "Discontinued", "ReorderLevel" });
4.自定绑定
ModelBinders.Binders[typeof(Product)] = new ProductBinder();
或者 [AcceptVerbs("POST")]
public ActionResult Edit([ModelBinder(typeof(ProductBinder))] Product product)
5.只去指定的属性
[AcceptVerbs("POST")]
public ActionResult Edit(string ProductName, string UnitPrice)