GrapeCity MultiRow Windows Forms Documentation
DoActionReason Property (CellValidateAction)
Example 


Gets or sets the reasons that cause a CellValidateAction to execute.
Syntax
<SRDescriptionAttribute("Indicates the reasons that cause a CellValidateAction to execute.")>
<DefaultValueAttribute()>
Public Property DoActionReason As ValidateReasons
Dim instance As CellValidateAction
Dim value As ValidateReasons
 
instance.DoActionReason = value
 
value = instance.DoActionReason
[SRDescription("Indicates the reasons that cause a CellValidateAction to execute.")]
[DefaultValue()]
public ValidateReasons DoActionReason {get; set;}

Property Value

A bitwise combination of ValidateReasons. The default is ValidateReasons.CellValidating.
Exceptions
ExceptionDescription
System.ComponentModel.InvalidEnumArgumentExceptionThe assigned value is not a valid ValidateComparisonOperator value.
Remarks
DoActionReason Values Description
1 - CellValidating Indicates that the CellValidateAction is executed during validation of the cell.
2 - RowValidating Indicates that the CellValidateAction is executed during validation of the rows.
4 - EndEdit Indicates that the CellValidateAction is executed when the cell exits the edit mode and the edited value is being applied to the cell.
8 - CancelEdit Indicates that the CellValidateAction is executed when the cell exits the edit mode, without the edited value being applied to the cell.
16 - CancelRow Indicates that the CellValidateAction is executed when the user cancels the edited value for the entire row by pressing the [Esc] key.
32 - EditedFormattedValueChanged Indicates that the CellValidateAction is executed when the user changes the value of the editing control, or the editing cell.
Example
The following code example shows how to use the provided CellValidators to execute different CellValidateActions for different reasons with DoActionReason.
void setRangeValidator_Click(object sender, EventArgs e)
        {
            Template template = Template.CreateGridTemplate(1);

            //Create one RangeValidator to validate whether the committed value is in range.
            RangeValidator rangValidator = new RangeValidator();
            //Set the RequiredType first, then set other Properties.
            rangValidator.RequiredType = typeof(int);
            rangValidator.MinValue = 5;
            rangValidator.MaxValue = 10;
            rangValidator.NullIsValid = false;

            LineNotify lineNotifyAction = new LineNotify();
            //When you end edit mode, the action is done (press Enter key)
            lineNotifyAction.DoActionReason = ValidateReasons.EndEdit;
            lineNotifyAction.LineColor = Color.Red;

            rangValidator.Actions.Add(lineNotifyAction);

            template.Row.Cells[0].Validators.Add(rangValidator);

            this.gcMultiRow1.Template = template;
            label.Text = "The RangeValidator's MinValue is 5, MaxValue is 10, input 4 (not in the range) in one cell, press 
Enter key to trigger validation (DoActionReason is EndEdit), a red underline is shown.";
        }
Private Sub setRangeValidator_Click(ByVal sender As Object, ByVal e As EventArgs) Handles setRangeValidator.Click
        Dim template As Template = template.CreateGridTemplate(1)

        'Create one RangeValidator to validate whether the committed value is in range.
        Dim rangValidator As New RangeValidator()
        'Set the RequiredType first, then set other Properties.
        rangValidator.RequiredType = GetType(Integer)
        rangValidator.MinValue = 5
        rangValidator.MaxValue = 10
        rangValidator.NullIsValid = False

        Dim lineNotifyAction As New LineNotify()
        'When you end edit mode, the action is done (press Enter key)
        lineNotifyAction.DoActionReason = ValidateReasons.EndEdit
        lineNotifyAction.LineColor = Color.Red

        rangValidator.Actions.Add(lineNotifyAction)

        template.Row.Cells(0).Validators.Add(rangValidator)

        Me.gcMultiRow1.Template = template
        label.Text = "The RangeValidator's MinValue is 5, MaxValue is 10, input 4 (not in range) in one cell, press Enter key to trigger validation (DoActionReason is EndEdit), a red underline is shown."
    End Sub
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

CellValidateAction Class
CellValidateAction Members

 

 


Copyright © GrapeCity, inc. All rights reserved.