开发者

Validation of List<int> property

I am using datannotations and the server/client side validation stuff in ASP.NET MVC 2. Everything works fine if a class has properties such as:

[Required(ErrorMessage = "whatever")]
String blah;

but I have no idea how to make t开发者_运维百科his:

[Range(13134, 42352345, ErrorMessage = "outside of range")]
List<int> blah;

where I want the int to be in that range.


I think you will have to write a custom validator to do this. This article by Scott Gu is useful for explaining writing custom validators

This msdn article may be more appropriate as it specifically discusses custom range validation

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜