ARTICLE

Introduction to Validation in Silverlight 4

Posted by Shankey Articles | Silverlight with C# October 29, 2010
Data validation is most important for data driven applications. This article talks about the basics of validation in Silverlight 4.
Reader Level:
Download Files:
 

Data validation is most important for data driven applications. This article talks about the basics of validation in Silverlight 4.

Following are some screen shots of how the sample application looks before and after the validation.

Before:

1.gif
 
After:
 
2.gif 

Following is an employee class which has two properties namely name and age. The properties of the employee class are validated whenever the user sets the properties. In this example, the following checks are made

For Name property : Name should not be empty and should contain only letters ("alphabets")
 
3.gif

4.gif 

For Age property : Age should be between 0 - 100

5.gif 

Following is the mainpage.xaml where you have to set the validation for the controls.

For textbox control accepting Name of employee
 
6.gif

For textbox control accepting Age of employee
 
7.gif

Login to add your contents and source code to this article
post comment
     

exception generating validation is not proper way .... validationondataerror porperty is proper

Posted by ankit patel Nov 02, 2012

well i like this

Posted by ankit patel Oct 29, 2012

test

Posted by ankit patel Oct 29, 2012

hi, i didn't got what you want to ask/say. sorry

Posted by Shankey Feb 24, 2011

throw new exception(how to handle exceptiom)

Posted by renu Feb 23, 2011
COMMENT USING
PREMIUM SPONSORS
DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and add new content to existing PDF documents from within your applications.
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.