Adding FrontEnd validator
WebForms has control validators, you can add a validator to a newly added control.
Let's say you want to add a required validator for a new textbox control.
Add the required validator in the Frontend and set an unique id.
myPage.html
Then, you have to declare the validator in the Backend file.
myPage.designer.cs
In the same file you have to initialize and set the necessary properties in the InitializeComponent
method
The ControlToValidate
property must be the same as the Control.Name
you want to validate. In the previous example we have a textbox with that name.
After these changes the new validator is ready.
Last updated