top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How do you validate the controls in an ASP .NET page?

+1 vote
515 views
How do you validate the controls in an ASP .NET page?
posted Jun 12, 2017 by Pooja Bhanout

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

An important aspect of creating ASP.NET Web pages for user input is to be able to check that the information users enter is valid. ASP.NET provides a set of validation controls that provide an easy-to-use but powerful way to check for errors and, if necessary, display messages to the user.

There are six types of validation controls in ASP.NET

RequiredFieldValidator (The RequiredFieldValidator control ensures that the required field is not empty).

RangeValidator (The RangeValidator control verifies that the input value falls within a predetermined range).

CompareValidator(The CompareValidator control compares a value in one control with a fixed value or a value in another control).

RegularExpressionValidator(he RegularExpressionValidator allows validating the input text by matching against a pattern of a regular expression).

CustomValidator(The CustomValidator control allows writing application specific custom validation routines for both the client side and the server side validation).

what ever i wrote above that answer you can find over internet easily but personally I prefer to use custom validator using client side(JavaScript) to validate a field .

There are so many Jquery to validate your controls in client side.

answer Jun 20, 2017 by Manikandan J
Similar Questions
+7 votes

How to create your own controls?
Basic steps will be helpful.

+4 votes

I have my Code . Kindly make it correct .

  protected void Button1_Click(object sender, EventArgs e)
  {
        System.Threading.Thread.Sleep(500);
        Image1.ImageUrl = "Below15.png";
        System.Threading.Thread.Sleep(500);
        Image1.ImageUrl = "Below26.png";
        System.Threading.Thread.Sleep(500);
        Image1.ImageUrl = "Below31.png";
        System.Threading.Thread.Sleep(500);
        Image1.ImageUrl = "Below40.png";
        System.Threading.Thread.Sleep(500);
        Image1.ImageUrl = "Above70.png";
 }
...