ComboBoxValidationRole class

Represents a validation rule for ComboBox controls.

Inherits from

Neurodot.Forms.Silverlight.Controls. LocalizableValidationRole

Syntax

public class ComboBoxValidationRole : LocalizableValidationRole

Properties

Name Description
AllowFirst Gets or sets a flag indicating whether the first item is a valid selection.
AllowNull Gets or sets a flag indicating whether it is valid to select no item.

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 validated combo box has any selected item or the first item is not selected depending on values of properties AllowNull and AllowFirst.

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 cbx = ThisForm.FindElement<ComboBox>("ComboBox1");
if (cbx != null)
{
	ThisForm.RegisterValidationRole(
		cbx, 
		new ComboBoxValidationRole() { 
			ResStringName = "$ComboBox1ValidationErr", 
			AllowNull = false, AllowFirst = false }
	);
}