| Control name |
Description |
| Requiredfieldvalidator |
Make sure that the user does not skip the input. |
| Comparevalidator |
Use comparison operators (less than, equal to, greater than, and so on) to compare user input with the constant value or attribute value of another control. |
| Rangevalidator |
Check whether user input is between the specified upper and lower boundary. Check the internal range of numbers, letters, or dates. The boundary can be expressed as a constant. |
| Regularexpressionvalidator |
Check whether the input matches the pattern defined by the regular expression. This verification type allows you to check for predictable character sequences, such as social security numbers, email addresses, phone numbers, and postal codes. |
| Customvalidator |
Use your own verification logic to check user input. This verification type allows you to check the value exported during runtime. |
| Validationsummary |
Displays verification errors for all validators on the page as a summary. |
< Script Language = "C #" runat = Server>
Void servervalidate (Object source, servervalidateeventargs value)
{
Int num = int32.parse (value. Value); If (Num % 2 = 0)
{Value. isvalid = true; return;
} Else
Value. isvalid = false;
} </SCRIPT> < Script Language = "JavaScript"> Function clientvalidate (source, arguments) {If (arguments. Value % 2 = 0) arguments. isvalid = true; else arguments. isvalid = false;} </SCRIPT>
<Form runat = "server"> <Asp: customvalidator id = "customvalidator1" runat = "server" controltovalidate = "text1" clientvalidationfunction = "clientvalidate" <! -- Client Server event name --> Onservervalidate = "servervalidate" <! -- Server event name --> Display = "static" font-name = "verdana" font-size = "10pt"> Not an even number! </ ASP: customvalidator> <P> < ASP: button text = "verify" onclick = "validatebtn_onclick" runat = "server"/> </Form>