In such a scenario, you would need to use the Custom Validator to provide the validation logic. NET's validation Web controls contain a required property called With the built-in validation controls, these steps are all performed behind the scenes for us, free of charge.

custom control not validating-21

One annoying task that most every developer has had to face in the past is form validation.

Since forms are an integral part of dynamic, data-driven Web sites, it is essential that a user's query into a form fit the specified guidelines.

Rows Dim ddl Reason Absent As Drop Down List = row SVL.

Find Control("ddl Reason Absent") Dim txt Hours Attend As Text Box = row SVL. Add(ddl Reason Absent) '1 'Write Client Script val.

NET validation controls is that they all provide client-side validation for uplevel browsers.

For example, if you visit the live demo with an uplevel browser you'll note that the Compare Validators exhibit client-side validation (enter a value of "bob" into the Text Box and tab out of it to see what I mean), while the Custom Validator does not (try entering a nonprime number, such as 6, into the Text Box - you are not alerted to the fact that the number you entered is not prime until you submit the form).

Developers had to write their own validation routines and cut and paste them in the various ASP scripts that needed to employ form validation techniques. Rather, it will dissect a particular control, the Custom Validator validation control.

(For more information on the other validation Web controls be sure to read Server Control Form Validation.) By simply using the first four ASP.

To do this, we must write a server-side validation event handler that will be responsible for performing the three steps above for our Custom Validator control.

This server-side validation event handler must have the following definition: event has to be wired up to our server-side validation event handler.

Imagine that you run a Web site for math nerds and that you have a form for users to provide some personal information to improve your knowledge of your site's demographics.