Tutorials
ASP.NET
ASP .NET: Validating User Input with C#
Required Field Validator
Regular Expression Validator
Range Validator
Compare Validator
Custom Validator
Validation Summary ControlRequired field validator is used for required fields. Fields that cannot be left empty is validated using the required field validator. A good example will be a TextBox which is used for taking the username as the input. Since the user must enter the username in the TextBox in order to access the website. The required field validator can be used with the TextBox control to validate the input. If user does not enter any data in the TextBox than an error message is displayed and further processing of the request will be stopped. In order to set the Required validator on the TextBox control just drag and drop the validator on the webform and set its ControltoValidate property to the TextBox id you want to validate.
The Page.IsValid property is true if the page does not have any error messages to display. The Required field validator performs the validation first on the client side and than on the server side.
Next Page: Regular Expression 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. |