how to use multiple AdditionalFields in remote validation - asp.net mvc

泄露秘密 提交于 2019-11-29 16:22:33

问题


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:

 [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?


回答1:


You could separate them by comma:

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


来源:https://stackoverflow.com/questions/8046841/how-to-use-multiple-additionalfields-in-remote-validation-asp-net-mvc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!