开发者

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")]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜