Manually calling ASP.NET Validation with JavaScript

I put a version of this function on the OnClientClick event of a ASP.NET button control.

The requirement I had was to find out how many validation controls fired, show a modal dialog and then set focus to the first Invliad Validator control. I left the modal dialog code out of this example as there are plenty of good resources on the web.

Page_ClientValidate() will force validation on the client side.

Page_Validators is a collection of Validation controls on the page in which you can access and evaluate however you see fit.

The ValidatorFocus() function is for my solution is called when my modal closes.

function ValidationCatcher()
{
    //force .net validation
    Page_ClientValidate();

    var count = 0;
    for(i=0; i < Page_Validators.length; i++)
    {
        if(!Page_Validators[i].isvalid)
        {
            count = count+1;
        }
    }
    //set msg for dialog message
    alert(count);

}

function ValidatorFocus()
{
    var i;
    for (i = 0; i < Page_Validators.length; i++)
    {
        if (!Page_Validators[i].isvalid)
        {
            document.getElementById(Page_Validators[i].controltovalidate).focus();
            break;
        }
    }
}

A few resources that I came across:
http://timstall.dotnetdevelopersjournal.com/validation_tips_for_validators.htm

http://www.codeproject.com/KB/validation/customvalidationscripts.aspx

Logging in .NET

Options:
Enterprise Library 3.1

*Populating and raising events from code
*Populating a log message with additional context information
*Tracing activities and propagating context information
*Checking filter status before constructing log messages.
*Configuring options for trace listeners

*Directing different event types to different trace listeners
*Configuring log filters
*Configure logging to be performed from a central location
*Creating a custom trace listener

    log4net 1.2.10
    log4net is a tool to help the programmer output log statements to a variety of output targets. In case of problems with an application, it is helpful to enable logging so that the problem can be located. With log4net it is possible to enable logging at runtime without modifying the application binary. The log4net package is designed so that log statements can remain in shipped code without incurring a high performance cost. It follows that the speed of logging (or rather not logging) is crucial.

    At the same time, log output can be so voluminous that it quickly becomes overwhelming. One of the distinctive features of log4net is the notion of hierarchical loggers. Using these loggers it is possible to selectively control which log statements are output at arbitrary granularity.

    log4net is designed with two distinct goals in mind: speed and flexibility