Well, I must have spent about an hour today trying to figure out something that I assumed would be pretty trivial, in fact it was in the end but you know how it goes.
I was creating a simple registration page for a website which requires that the user agrees to the Terms and Conditions of the site before they can submit their registration details. To begin with, I had a check box that the user would have to tick in order to state that they agreed and only when this check box was checked would the submit button be enabled, however, as I had disabled the submit button on the load of the page, all other required field validators stopped working. I assume as the submit button was disabled, ASP.NET didn't feel the need to continue wiring up the validation code necessary. So I thought that I would use one of the validation controls to ensure that the check box was checked thus no need to disable the submit button.
function ValidateTandCs(source, args)
args.IsValid = document.getElementById('<%= chkTandCs.ClientID %><%= chkTandCs.ClientID %>').checked;
Now, modify your CustomValidator control so that it reads:
<asp:CustomValidator ID="valTandCs" ClientValidationFunction="ValidateTandCs" runat="server" ErrorMessage="Please accept Terms and Conditions before submitting.">< FONT>asp:CustomValidator>
To prove that it definitely worked, I added the following code to the click event of the button:
Response.Write("Page posted back")
Which only writes out to the page once it is posted to the server.
I certainly learnt something new today :)