Getting Started with WinForms ValidationProvider
This article will give you getting started experience with RadValidationProvider without using any code.
The TelerikMetro theme is used for the screenshots in this article.
-
To start using RadValidationProvider just drag it from the toolbox and drop it onto the form:
-
Drag one RadTextBox and two RadDateTimePicker controls from the toolbox.
-
Open the FilterDescriptor Collection Editor by clicking the Edit Validation Rules option in the Smart tag.
-
Add a RadValidationRule:
-
Select RadTextBox from the Controls drop down list:
-
Select the Operator to be IsNotLike, leave the PropertyName to be Text and specify the ToolTipText:
The data type of the Value can be specified after entering a value first and then selecting the type from the drop down.
As of R3 2020 RadValidationProvider supports nested PropertyNames to validate, e.g. Text.Length.
-
If you start the application now, focus the RadTextBox control, leave it empty and try to navigate to another control, the validation will fail. It would be necessary to enter some text before proceeding further:
-
Add a second validation rule. But this time add a RadValidationRuleWithTargetControl:
-
In the Controls drop down list, select radDateTimePicker1. In the TargetControl drop down list, select radDateTimePicker2. Set the Operator to IsLessThan. Specify the PropertyName and TargetControlPropertyName to Value and what ToolTipText to be displayed when the validation failed.
-
This rule will ensure that the first RadDateTimePicker's value is less than the value of the second one:
In a similar way you can add a rule to validate that the second RadDateTimePicker's value is greater than the value of the first one.
See Also
Telerik UI for WinForms Learning Resources
- Telerik UI for WinForms ValidationProvider Component
- Getting Started with Telerik UI for WinForms Components
- Telerik UI for WinForms Setup
- Telerik UI for WinForms Application Modernization
- Telerik UI for WinForms Visual Studio Templates
- Deploy Telerik UI for WinForms Applications
- Telerik UI for WinForms Virtual Classroom(Training Courses for Registered Users)
- Telerik UI for WinForms License Agreement)