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

时间:2021-11-08 17:20:09

I need to validate the duplicate of FirstName, LastName and Email Address combination using remote validation in my ASP.NET MVC 4 (C#) application. The Remote Validation accepts only one AdditionalFields, which is as below:

我需要在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; }

How can i add the EmailAddress for the combination?

如何为组合添加EmailAddress?

1 个解决方案

#1


34  

You could separate them by comma:

你可以用逗号分隔它们:

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

#1


34  

You could separate them by comma:

你可以用逗号分隔它们:

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