Click here to Skip to main content
15,889,034 members
Articles / Web Development / ASP.NET

Custom Validation Scripts - Extending the client side script functionality

Rate me:
Please Sign up or sign in to vote.
4.71/5 (28 votes)
24 Jan 20055 min read 123.2K   922   59  
Override the default implementention of client side validation of ASP.NET and modify the default functionality by adding focus to error fields and individual alerts for each invalid field
<VisualStudioProject>
    <VisualBasic
        ProjectType = "Web"
        ProductVersion = "7.10.3077"
        SchemaVersion = "2.0"
        ProjectGuid = "{B85E45B9-3AEA-465C-ABF7-EF8F20244029}"
    >
        <Build>
            <Settings
                ApplicationIcon = ""
                AssemblyKeyContainerName = ""
                AssemblyName = "customvalidationscripts"
                AssemblyOriginatorKeyFile = ""
                AssemblyOriginatorKeyMode = "None"
                DefaultClientScript = "JScript"
                DefaultHTMLPageLayout = "Grid"
                DefaultTargetSchema = "IE50"
                DelaySign = "false"
                OutputType = "Library"
                OptionCompare = "Binary"
                OptionExplicit = "On"
                OptionStrict = "Off"
                RootNamespace = "customvalidationscripts"
                StartupObject = ""
            >
                <Config
                    Name = "Debug"
                    BaseAddress = "285212672"
                    ConfigurationOverrideFile = ""
                    DefineConstants = ""
                    DefineDebug = "true"
                    DefineTrace = "true"
                    DebugSymbols = "true"
                    IncrementalBuild = "true"
                    Optimize = "false"
                    OutputPath = "bin\"
                    RegisterForComInterop = "false"
                    RemoveIntegerChecks = "false"
                    TreatWarningsAsErrors = "false"
                    WarningLevel = "1"
                />
                <Config
                    Name = "Release"
                    BaseAddress = "285212672"
                    ConfigurationOverrideFile = ""
                    DefineConstants = ""
                    DefineDebug = "false"
                    DefineTrace = "true"
                    DebugSymbols = "false"
                    IncrementalBuild = "false"
                    Optimize = "true"
                    OutputPath = "bin\"
                    RegisterForComInterop = "false"
                    RemoveIntegerChecks = "false"
                    TreatWarningsAsErrors = "false"
                    WarningLevel = "1"
                />
            </Settings>
            <References>
                <Reference
                    Name = "System"
                    AssemblyName = "System"
                />
                <Reference
                    Name = "System.Data"
                    AssemblyName = "System.Data"
                />
                <Reference
                    Name = "System.Drawing"
                    AssemblyName = "System.Drawing"
                />
                <Reference
                    Name = "System.Web"
                    AssemblyName = "System.Web"
                />
                <Reference
                    Name = "System.XML"
                    AssemblyName = "System.Xml"
                />
            </References>
            <Imports>
                <Import Namespace = "Microsoft.VisualBasic" />
                <Import Namespace = "System" />
                <Import Namespace = "System.Collections" />
                <Import Namespace = "System.Configuration" />
                <Import Namespace = "System.Data" />
                <Import Namespace = "System.Drawing" />
                <Import Namespace = "System.Web" />
                <Import Namespace = "System.Web.UI" />
                <Import Namespace = "System.Web.UI.HtmlControls" />
                <Import Namespace = "System.Web.UI.WebControls" />
            </Imports>
        </Build>
        <Files>
            <Include>
                <File
                    RelPath = "AssemblyInfo.vb"
                    SubType = "Code"
                    BuildAction = "Compile"
                />
                <File
                    RelPath = "Global.asax"
                    BuildAction = "Content"
                />
                <File
                    RelPath = "Global.asax.vb"
                    DependentUpon = "Global.asax"
                    SubType = "Code"
                    BuildAction = "Compile"
                />
                <File
                    RelPath = "Global.asax.resx"
                    DependentUpon = "Global.asax.vb"
                    BuildAction = "EmbeddedResource"
                />
                <File
                    RelPath = "Styles.css"
                    BuildAction = "Content"
                />
                <File
                    RelPath = "Web.config"
                    BuildAction = "Content"
                />
                <File
                    RelPath = "WebForm1.aspx"
                    BuildAction = "Content"
                />
                <File
                    RelPath = "WebForm1.aspx.vb"
                    DependentUpon = "WebForm1.aspx"
                    SubType = "ASPXCodeBehind"
                    BuildAction = "Compile"
                />
                <File
                    RelPath = "WebForm1.aspx.resx"
                    DependentUpon = "WebForm1.aspx.vb"
                    BuildAction = "EmbeddedResource"
                />
                <File
                    RelPath = "WebUIValidation.js"
                    BuildAction = "Content"
                />
            </Include>
        </Files>
    </VisualBasic>
</VisualStudioProject>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Brazil Brazil
Mauricio Ritter lives in Brazil, in the city of Porto Alegre. He is working with software development for about 8 years, and most of his work was done at a bank, within a home and office banking system.
Mauricio also holds MCSD, MCSE, MCDBA, MCAD and MCT Microsoft certifications and work as a trainer/consultant in some MS CTEC in his city.
Mauricio also works in his own programming site, aimed to Brazilian Developers: http://www.dotnetmaniacs.com.br

In his spare time he studys korean language...

Comments and Discussions