本文介绍了如何禁用MVC验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Class UserEntity
经过验证

I have Class UserEntity
with validation

 public class UserEntity
    {


        public Int64? UID { get; set; }

        [Required]
        [Display(Name = "Customer Name")]

        public string Name { get; set; }
        [Required]
        [Display(Name = "User Name/ Mobile Number")]
        [RegularExpression("^[0-9]{10}$", ErrorMessage = "User Name Should be 10 digit Mobile No")]

        [Remote("IsUserAvailable", "Login", AdditionalFields = "UID")]
        public string UserName { get; set; }
        [Required]
        [Display(Name = "Password")]
        public string Password { get; set; }
        [Required]
        [Display(Name = "Confirm Password")]
        [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]

}



它可以很好地与注册表一起使用,但是在登录时我想禁用所有验证

尝试过



it working fine with Registration Form but in Login i want to disable all validation

tried

@Html.EditorFor(model => model.BatchId, new {@class = "k-textbox", data_val = false})

推荐答案



它可以很好地与注册表一起使用,但是在登录时我想禁用所有验证

尝试过



it working fine with Registration Form but in Login i want to disable all validation

tried

@Html.EditorFor(model => model.BatchId, new {@class = "k-textbox", data_val = false})



这篇关于如何禁用MVC验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 05:00