我有模式: public class MyModel
...fields
[Remote(ActionName, ControllerName)]
public string SomeNumber { get; set; }
..fields
而且在ControllerName控制器中的作用: public JsonResult ActionName(string someNumber
我收到來自上級的指令,使用遠程驗證而不是RequiredIf屬性來檢查特定字段是否具有值能夠被用戶編輯。 現在,我的代碼看起來是這樣的 - 視圖模型 public class FooModel
{
// SNIP: Unimportant extra variables
public int? DeviceId;
public int? ProviderId;
我想驗證三個字段中至少有一個不爲空。我正在嘗試使用ASP.NET遠程驗證機制來做到這一點。 我有以下模式: public class MyModel
{
public MyModel()
{
EmployeeIds = new List<int>();
ManagerIds= new List<int>();
}
這裏是我的模型代碼 public class BlobAppModel
{
[Required(ErrorMessage="Please enter the name of the image")]
[Remote("IsNameAvailable","Home",ErrorMessage="Name Already Exists")]
public string