现在的位置: 首页 > 综合 > 正文

silverlight: Validation

2013年01月08日 ⁄ 综合 ⁄ 共 6391字 ⁄ 字号 评论关闭

.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

 

 

抱歉!评论已关闭.