first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

MCAD/MCSD Notes: Chapter 4, Lesson 2; Using Validation

Lesson 2: Using Validation

The purpose of this lesson is to detail the validation controls in ASP.NET.

It is important to note that the client-side validation features in ASP.NET work only in Microsoft Internet Explorer version 4.0 and later. This is why validation controls automatically provide server-side validation. (Incidentally, the sample Web form Validation1.aspx uses a call to Server.Transfer() that breaks the automatic server-side validation functionality.)

The validation controls: RequiredFieldValidator, CompareValidator, RangeValidator, RegularExpressionValidator, CustomValidator and ValidationSummary.

The lesson details a problem (in Table 4-7) with the CompareValidator control that can be solved by combining it with a RequiredFieldValidator control.

Clicking on this Submit HTML control will cause a postback and in the Page_Load event procedure below, the variable bln will be false:

bool bln;
if(this.IsPostBack)
{
    this.Validate();
    bln = this.IsValid;
}

There is a typo in this lesson stating effectively that bln would be true.

This may be one of very few places where an external JavaScript file could seamlessly integrate with an ASP.NET Web form design pattern.

mod date: 2005-04-12T06:16:31.000Z