MVC-type validation
Hey i have model and it looks like this:
[Required(ErrorMessage = "Morate unijeti vrijednost")]
public int Cijena{ set; get; }
If user doesn't enter value , my error message is being written, but if user enter value that is not int I got this message "The value '' is not valid for Cij开发者_如何学Goena" . How can I overwrite this message with custom one? Thx
Use a regular expression validator as well
http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.regularexpressionattribute(v=vs.95).aspx
[RegularExpression(Pattern=@"\d+", ErrorMessage="only numbers please")]
精彩评论