Tutorials
ASP.NET
ASP .NET: Validating User Input with C#
Required Field Validator
Regular Expression Validator
Range Validator
Compare Validator
Custom Validator
Validation Summary ControlThis tutorial covers Validating User Input with C# covers Overview of ASP.NET Validation Controls , Using the Simple Validators , Using the Complex Validators and Summarizing Results with the Validation Summary Control.
In this tutorial we will see the validation controls. The purpose of the validation controls is to validate the user input. Asp.net provides the developer with different types of validation controls. One most important point to note is that the validation is done on the client side as well as on the server side. You can always turn the validation on the client side off using the enable client side property to false. Lets see the difference between the client side validation and the server side validation.
Client side validation
When you place validation code on the client side, validation does not require a postback operation and provides fast responses to the user. However, because the validation code is outside the Web Server, it might be possible for the client to spoof the Web Server with invalid data. The addition to this, client-side validation requires the client to be capable of running scripts. That might be an issue with old browsers and some new browsers in which users turn off script execution thinking that scripts are unsafe. This client-side validation should never be used as the only validation technique to validate data on a Web page.
Server Side Validation
When the validation code is placed the server side, the process of validation might be slow because a form might involve multiple roundtrips to the Web Server before all the data is validated. On the other hand, because the Web Server is performing all the validation, you can trust the validated data. Server-side validation works well with even primitive browsers because it does not assume any specific browser capabilities.
(MCAD/MCSD Developing and implementing Web Applications with Visual C# .NET and Visual Studio. NET)
Next Page: Required Field Validator
| The course material is very helpful |
| :D Good day! I used validators in my web app and running them locally but my problem is when I copy the system in the live environment the validator did not work. Any possible solution? I check the properties of the validator and compare them in all the examples found in the internet but I have the same result. Can you help me in my problem? :'( |
| this will be really helpful not only for experienced developers but for beginners also. |
|
how can i get the page to pass thru if its not valid ie, id like to be able to write some like this if (Page.IsPostBack) { Page.Validate; if (Page.IsValid) { do seomthing } else { do something else } } but the something else doesnt work cuase as soon as it doesnt pass the validators it never gets past the postback am i barking up the wrong tree here? thanks for any help |
|
This is really a very helpful n nice article. I really behefited from it and enjoyed it. ;D |
|
Hi , This is vaibhav. I recently started to learn self .NET. Initially i found it to be harder than j2EE but tnow I realised that its a preety easy. This article helped me alot to know the basic concepts. |
| thank you very much, help me solve a tough problem^^ |
| I had some doubt in validaton ontrols .. now i got some idea after reaing this article.. thanks for this aticle writer........... |
|
Thanks for the nice article..solve my problems.. --jamesbond-- |
|
This is a compact and easy to read n understand material. This is very very useful for quick review. Thanksto the writer. |
| how to make owr own regular expressions using the using System.Text.RegularExpressions; |
|
hi, I started .net recently and want to know that how I can apply a validation to a text box so that it can not be leave blank. what I'm trying is if (TxtRegNo.Text.ToString() == "") { MessageBox.Show("Fill Registration no"); } It is working but it saves that blank data into the database. plz give me a solution |
| I want to make validation for ASP.NET with C# how can I put it and for 1 time I want to use the validation for all the pages. |