Click here to Skip to main content
15,901,122 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello everyone,

I am working on a silverlight project, I need to perform some client side validations here. If a user enters an invalid value in a particula field, then immediately it should prompt the user about the error. And also i need to allow user to enter values only in a particular format. Do we have anything like masked text boxes, or regular expressions in Silverlight. Please help me in this regard. Thanks in advance.
Posted
Comments
Christian Amado 16-Aug-12 8:12am    
You can search on Google about DataAnnotations

1 solution

 
Share this answer
 
Comments
krishnaprasad62 4-Sep-12 7:15am    
Hi,

I am using DataAnnotations to perform validations, in my Silverlight MVVM application. I am specifying Range attibute for the properties as follows.


private int _age;
[Range(0,100)]
public int Age
{
get{return _age;}
set
{
Validator.ValidateProperty(value, new ValidationException(this,null,null) {MemberName="Age"});
_age=value;
OnPropertyChanged("Age");
}
}

This code is working fine when integer values are entered in the text box. But when some special characters are enterd in the text box it is not validating. . .
Any idea. . .
Thanks in advance. . .
arti s.v 4-Sep-12 7:56am    
Go through http://www.dotnetfunda.com/codes/code458-special-character-validation.aspx it may help u...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900