This is a mirror of official site: http://jasper-net.blogspot.com/

Data Validation in Silverlight using Data Annotations and Data Form

| Wednesday, June 15, 2011
While using Silverlight for developing Line-of-Business applications, the DataForm control is recommended for performing DML operations. This control provides data pagination, insert, and update and delete operations on the records. This control provides ItemsSource property which accepts collection type as an input e.g. ObservableCollection. But while performing Insert and Update operations, it is important to perform Data Validations. In Silverlight, we have been provided with the IDataErrorInfo and INotifyDataErrorInfo interfaces for Data Validations. At the same time, we have been provided with DataAnnotation features using which properties in the source class, can be validated. In the code below, I have demonstrated the use of data annotation for data validations.

Step 1: Open VS2010 and create a new Silverlight application, name it as ‘SL4_DataForn_DataAnnotation’.

Step 2: In the project, add a new class, name it as DataClass.cs, and use the following namespaces in the class:

Read more: Devcurry

Posted via email from Jasper-net

0 comments: