如何在远程验证中使用多个AdditionalFields - asp.net mvc

时间:2011-11-08 06:47:05

标签: asp.net-mvc remote-validation

我需要在ASP.NET MVC 4(C#)应用程序中使用远程验证来验证FirstName,LastName和Email Address组合的副本。远程验证只接受一个AdditionalFields,如下所示:

 [Remote("IsUserNameAvailable", "User", AdditionalFields="LastName" )]
 public string FirstName{ get; set; }
 public string LastName{ get; set; }
 public string EmailAddress{ get; set; }

如何为组合添加EmailAddress?

1 个答案:

答案 0 :(得分:42)

您可以用逗号分隔它们:

[Remote("IsUserNameAvailable", "User", AdditionalFields="LastName,EmailAddress" )]