title: ASP.Net Custom Client-Side Validation
body: <p>I have a custom validation function in JavaScript in a user control on a .Net 2.0 web site which checks to see that the fee paid is not in excess of the fee amount due. </p>
  
  <p>I've placed the validator code in the <code>ascx</code> file, and I have also tried using <code>Page.ClientScript.RegisterClientScriptBlock()</code> and in both cases the validation fires, but cannot find the JavaScript function.</p>
  
  <p>The output in Firefox's error console is <code>"feeAmountCheck is not defined"</code>. Here is the function (this was taken directly from firefox->view source)</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function feeAmountCheck(source, arguments)
      {
          var amountDue = document.getElementById('ctl00_footerContentHolder_Fees1_FeeDue');
          var amountPaid = document.getElementById('ctl00_footerContentHolder_Fees1_FeePaid');
  
          if (amountDue.value &gt; 0 &amp;&amp; amountDue &gt;= amountPaid)
          {
              arguments.IsValid = true;
          }
          else
          {
              arguments.IsValid = false;
          }
  
          return arguments;
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>Any ideas as to why the function isn't being found? How can I remedy this without having to add the function to my master page or consuming page?</p>