ASP.Net Custom Client-Side Validation
I've placed the validator code in the
ascx file, and I have also tried using
The output in Firefox's error console is
"feeAmountCheck is not defined". Here is the function (this was taken directly from firefox->view source)
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?
4 answers given for "ASP.Net Custom Client-Side Validation"
Try changing the argument names to
args. And, after you have it working, switch the call over to
ScriptManager.RegisterClientScriptBlock, regardless of AJAX use.
When you're using .Net 2.0 and Ajax - you should use:
It will work better in Ajax environments then the old Page.ClientScript version
Asp:CompareValidator instead of an
Also you could use:
var amountDue = document.getElementById('<%=YourControlName.ClientID%>');
That will automatically resolve the client id for the element without you having to figure out that it's called