微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

silverlight: Validation

.Problem

I take a look the silverlight toolkit,I found the silverlight 3 have new data validation function.

it is very good function,It support regularExpression in attribute .

Like this:

 

 

 

But I found one problem.

you can take a look my code careful,Age property is Integer .

when I input the data is string,for example "dddd",it don't throw my define the error message, 

It throw the message is "input is not correct format",I don't kNow this reason.

 

Bu I think careful,it maybe is correct. because I input is string,C# level will auto throw the error message.

Don't go into my define error message.

 

 

If you input the integer more than two length,it will throw my define the error message.

 

.solution

you can define the age is string type,It will fixed this problem.

you can follow your state to decide to what to do.

I only advise you to change string type.

 

 

sample code:

 

Person.cs

 

 

views

 

 

code-behind

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐