Skip to content Skip to sidebar Skip to footer

Not Getting Validation Error Messages From Dataannotation Validations

I am have a simple model class for Login, with few DataAnnotation Validations Public Class LoginUser _ Public Property UserName As String

Solution 1:

you need to add some error messages to your annotation

PublicClass LoginUser
    <Required()(ErrorMessage:="Username is required.")> _
    PublicProperty UserName AsString

    <Required(ErrorMessage:="Pssword is required.")> _
    <StringLength(8)> _
    PublicProperty Password AsStringEndClass

not sure if it will make a difference but try adding true like this

    <%= Html.ValidationSummary(true)%>
<% Html.EnableClientValidation(true)%>

Post a Comment for "Not Getting Validation Error Messages From Dataannotation Validations"