SIGN UP MEMBER LOGIN:    
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
share this article :
post comment
 

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
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Team Foundation Server Hosting
Become a Sponsor