void setRangeValidator_Click(object sender, EventArgs e)
{
Template template = Template.CreateGridTemplate(1);
//Create one RangeValidator to vaidate whether the committed value is between one range.
RangeValidator rangValidator = new RangeValidator();
//You should 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 ends edit mode, the action will be done.(press Enter key commonly)
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 between the range) in one Cell, press Enter key to trigger validation(DoActionReason is EndEdit), one red under line will be 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 vaidate whether the committed value is between one range.
Dim rangValidator As New RangeValidator()
'You should 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 ends edit mode, the action will be done.(press Enter key commonly)
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 between the range) in one Cell, press Enter key to trigger validation(DoActionReason is EndEdit), one red under line will be shown."
End Sub