爲什麼MVC仍然驗證此屬性,因爲我已經排除了它?忽略[必填]數據註釋
...
[Required(ErrorMessage = "Please enter activation code")]
public string ActivationCode { get; set; }
...
[HttpPost]
public ViewResult CreateAccount([Bind(Exclude = "ActivationCode ")] AccountCreationViewModel m, string returnUrl)
...
你爲什麼要排除的屬性?我看到你正在使用視圖模型。從視圖模型中排除屬性的方法根本不是定義它:-) – 2011-03-04 15:16:46