c# - Want to add a validation using regular expression the format should be like this xxxxx-xxxxxxx-x -
i trying put validation using regular expression value text box xxxxx-xxxxxxx-x here trying
[required] [display(name = "cnic")] [regularexpression(@"^\(([0-9]{5})[-]([0-9]{7})[-][0-9]{1}\)$", errormessage = "entered cnic format not valid.")] public string cnic { get; set; }
but shows cnic format not valid
[regularexpression(@"^[0-9+]{5}-[0-9+]{7}-[0-9]{1}$", errormessage = "entered cnic format not valid.")]
Comments
Post a Comment