Export (0) Print
Expand All

Validator Control Samples

.NET Framework 1.1

The validator controls presented here are simplified versions of the validator controls that ship with the .NET Framework. Unlike the validator controls in the SDK, which work only with Internet Explorer, these controls comply with the World Wide Web Consortium Document Object Model Level 1 specification (W3C DOM Level 1) and support a number of browsers such as Internet Explorer 5, Netscape Navigator 6, and Opera 5.

The following list describes the sources of the different pieces of the sample:

To compile and deploy this sample

  1. Create a virtual rooted Web application directory and copy all the files into that directory. Name the files as follows.
    File NameFile in Topic
    BaseDomValidator.cs

    or

    BaseDomValidator.vb

    Source file in Base Validator Control Sample.
    RegexDomValidator.cs

    or

    RegexDomValidator.vb

    Source file in Regular Expression Validator Control Sample.
    RequiredDomValidator.cs

    or

    RequiredDomValidator.vb

    Source file in Required Field Validator Control Sample.
    DomValidation.jsScript file in Script Library for Validator Sample.
    ValTest.aspx Test page in Test Page for Validator Sample.
    ValTest.aspx.cs

    or

    ValTest.aspx.vb

    Code-behind file for the test page in Test Page for Validator Sample.
    Web.configConfiguration file in Configuration File for Validator Sample.
  2. In the Web application directory that you created, create a batch file that contains the following commands. (Save the batch file with the extension .bat, such as BuildFile.bat).
    if not exist .\script md .\script
    if not exist .\bin md .\bin
    copy DomValidation.js .\script\DomValidation.js
    echo Copied File.
    csc /t:library /out:.\bin\DomValidators.dll /r:System.dll /r:System.Web.dll /r:System.Drawing.dll BaseDomValidator.cs RegexDomValidator.cs RequiredDomValidator.cs 
    echo Built Library.
    [Visual Basic]
    if not exist .\script md .\script
    if not exist .\bin md .\bin
    copy DomValidation.js .\script\DomValidation.js
    echo Copied File.
    vbc /t:library /out:.\bin\DomValidators.dll /r:System.dll /r:System.Web.dll /r:System.Drawing.dll BaseDomValidator.vb RegexDomValidator.vb RequiredDomValidator.vb 
    echo Built Library.
    
  3. Execute the batch file you created in step 2. If your build file is named BuildFile.bat, execute the following command from the Web application directory.
    BuildFile.bat 
    

See Also

Base Validator Control Sample | Required Field Validator Control Sample | Regular Expression Validator Control Sample | Script Library for Validator Sample | Configuration File for Validator Sample | Test Page for Validator Sample | Client-Side Functionality in a Server Control

Show:
© 2014 Microsoft