Home
Technical Training
ASP.NET Training
ASP .NET: Validating User Input with C#
Required Field Validator
Regular Expression Validator
Range Validator
Compare Validator
Custom Validator
Validation Summary Control
This tutorial is part of a ASP.NET Training tutorial series. Read it from the beginning and learn yourself.
Technical Training
ASP.NET TrainingTable of Contents
ASP .NET: Validating User Input with C#
Required Field Validator
Regular Expression Validator
Range Validator
Compare Validator
Custom Validator
Validation Summary ControlCustom Validator
Page 6 of 7
Author : Exforsys Inc. Published on: 4th Mar 2005 | Last Updated on: 18th Dec 2010
ASP .NET: Validating User Input with C#
Ads
Custom Validators can be used to make your own custom validation expressions. You can find many free regular expressions on the website www.Regexlib.com. Here is a small example of the Custom Validator Control.
Sample Code
- // This is the server side validation
- // Double click the Custom Validator and write this code
- {
- string strPalindrome = args.Value;
- string strReverse = "";
- // Reverse the string
- for(int intI = strPalindrome.Length -1; intI>=0; intI--) strReverse = strReverse + strPalindrome[intI];
- if(strReverse == strPalindrome)
- {
- args.IsValid = true;
- }
- else
- {
- args.IsValid = false;
- }
- }
Copyright exforsys.com
This validator simply checks that if the string entered is palindrome or not. (Developing and Implementing Web Applications, Kalani).
Ads
Read Next: Using Rich Server Controls with C#
ASP.NET Training
- ASP.NET with C# Training Launch
- ASP.NET with C# Training Course Outline
- Introduction to ASP.NET with C#
- ASP.NET Web Forms Controls
- ASP .NET: Validating User Input with C#
- Using Rich Server Controls with C#
- Accessing Data with C#
- ASP.NET Using the DataList and Repeater, Datagrid Controls
- Managing Data with ADO.NET DataSets and C#
- Creating and consuming XML Web Services with C#
- ASP .NET Migration and Interoperability
- Managing State with ASP.NET and C#
- Caching in ASP.NET
- Configuring and Deploying ASP.NET Applications
- Securing ASP.NET Applications with C#







