About CustomValidator
-
How to write client-side validation code? E.G. a page has a dorpdownlist(identityDdl), a TextBox(identityTxt) and a TextBox(remarkTxt) identityDdl has 3 items: Indentity Card, Martial Certificate and other when selected "Indentity Card" or "Martial Certificate " check id of the correct format use CustomValidator on client, when selected "other" dont check. if the characters more than 300 of remarkTxt. With CustomValidator How to validat on client? How to verify the results back to the CustomValidator? Thanks.
-
How to write client-side validation code? E.G. a page has a dorpdownlist(identityDdl), a TextBox(identityTxt) and a TextBox(remarkTxt) identityDdl has 3 items: Indentity Card, Martial Certificate and other when selected "Indentity Card" or "Martial Certificate " check id of the correct format use CustomValidator on client, when selected "other" dont check. if the characters more than 300 of remarkTxt. With CustomValidator How to validat on client? How to verify the results back to the CustomValidator? Thanks.
-
You can use javascript for it.get the control by its ID,then check the value and for correct format you can REGEX.
Cheers!! Brij
I saw so many people write like this:
<script type="text/javascript">
function valComments\_ClientValidate(source, args) { if (args.Value.length > 10) args.IsValid = false; else args.IsValid = true; } </script>
But I try it not successful. How to setting the page validat is true or false?
-
I saw so many people write like this:
<script type="text/javascript">
function valComments\_ClientValidate(source, args) { if (args.Value.length > 10) args.IsValid = false; else args.IsValid = true; } </script>
But I try it not successful. How to setting the page validat is true or false?
This looks OK. Do you have firebug installed? If yes, try to debug your JS.
Navaneeth How to use google | Ask smart questions