远程验证未针对MVC启用 [英] Remote Validation not Fired for MVC
问题描述
亲爱的,
目前我正面临与MVC 4远程验证相关的问题。
我有1个型号名称UserModel沿远程验证
[DataType(DataType.EmailAddress)]
[StringLength( 50 ) ]
[远程( IsNameExists, 用户,ErrorMessage = 登录ID /电子邮件已经在使用中。)]
public string UserLogon
{
get ;
set ;
}
现在,多个视图使用的模型如User&注册,两个视图都具有相同的模型值,如
@ Html.TextBoxFor(model => model.UserLogon,
new {placeholder =Enter Email,@ class = inputSPCL,@ maxlength =50})
@ Html.ValidationMessageFor(model => model.UserLogon)
但是问题是,上面的远程验证为用户视图触发但没有工作
用于注册。
任何人都可以帮我这个吗?
关心
值得阅读这篇文章来自
如何:在ASP.NET中实现远程验证MVC [ ^ ]
Dear All,
Currently i am facing a problem related to MVC 4 Remote Validation.
I have 1 models Name UserModel along with remote validation
[DataType(DataType.EmailAddress)]
[StringLength(50)]
[Remote("IsNameExists", "User", ErrorMessage = "Login ID/Email Already is in use.")]
public string UserLogon
{
get;
set;
}
Now ,above models being used by Multiple view like User & Signup , both views have same model value like
@Html.TextBoxFor(model => model.UserLogon,
new { placeholder = "Enter Email", @class = "inputSPCL", @maxlength = "50" })
@Html.ValidationMessageFor(model => model.UserLogon)
But problem is that, above Remote validation fired for User View but not working
for Signup.
Can any one please help me on this?
Regards
It is worth reading this article from
How to: Implement Remote Validation in ASP.NET MVC[^]
这篇关于远程验证未针对MVC启用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!