![]() Return string.Join("\n", results.Select(x => x. New ValidationContext(this, null, null), results, true) Var result = Validator.TryValidateObject(this, Var result = Validator.TryValidateProperty( ![]() Var propertyDescriptor = TypeDescriptor.GetProperties(this) ![]() There is a Validator class in which has a couple of methods which allows us to validate an object or a property of an object using validation attributes: using Notice that when SuperValidator component is added to the form it automatically creates two supporting components: ErrorProvider component to display the error. For example DataRowView which is the main model which is usually used in classic ADO.NET applications, has implemented IDataErrorInfo. To bring validation attributes support to our model classes, we need to implement IDataErrorInfo. To be able to show model errors in DataGridView or showing errors using ErrorProvider the model which you are using in data binding should implement IDataErrorInfo. Implementing IDataErrorInfo using Data Annotations Validation Attributes
0 Comments
Leave a Reply. |