javascript OO question - specify private member function in c# object?
<p>I'm not sure how to achieve the following in javascript, or even if I'm thinking about it correctly. Basically I want to attach a javascript member function to each custom object rendered, so I could have something like this in C#:</p>

<pre><code>public class NumericTextBox : TextBox
{
    ...
    string clientScript = "function isValid() { return isNumericValue(this.value); }"; 
    AttachValidationFunction(clientScript);
}

public class EmailTextBox : TextBox
{
    ...
    string clientScript = "function isValid() { return isEmail(this.value); }"; 
    AttachValidationFunction(clientScript);
}
</code></pre>

<p>and then use the following javascript function in the page</p>

<pre><code>function isFormValid() {
    var controls = getElementsByClass("validatingControl");
    ...
    if (!controls[i].isValid()) return false;
    ...
}
</code></pre>

<p>obvisouly in pseudo-code, but hopefully that gives the idea of what I need to achieve. Any suggestions?</p>
