AttachmentsValidationRole class

Represents a validation rule for Attachments controls.

Inherits from

Neurodot.Forms.Silverlight.Controls.LocalizableValidationRole

Syntax

public class AttachmentsValidationRole : LocalizableValidationRole

Properties

Name Description
MaxFiles Gets or sets how many files maximum is allowed.
MinFiles Gets or sets how many files at least are needed.

Methods

Name Description
Validate(object) Validates assigned control and raises or hides validation error on the control.

Remarks

The Validate(object) method checks whether the number of attached files is not less than MinFiles and not more than MaxFiles if the values of those properties are set.

See methods RegisterValidationRole and RemoveValidationRole for details on how to assign custom validations to controls.

Example

The following example sets up validation for Attachments control named “Attachments1”. The validation checks whether the control has at least one attached file.

Attachments attch = ThisForm.FindElement<Attachments>("Attachments1");
if (attch != null)
{
	ThisForm.RegisterValidationRole(
		chbox, 
		new AttachmentsValidationRole() { 
			ResStringName = "$Attachments1ValidationErr", 
			MinFiles = 1 }
	);
}