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
0 comments:
Post a Comment