Add CustomValidator verification to a text control in the user control, and set the ClientValidationFunction attribute of CustomValidator to the client's Validate (source, args) method,
If the user control is used in two places on a page, and then click save button for verification, you will find that this verification is not the one you want. Why, originally, two user controls were used
Two Validate methods are generated, but only one method is used. Therefore, only one of them can be verified. to verify both methods, you must specify different methods for ClientValidationFunction,
You can take the following steps:
In UserControl. cs, assign a value to ClientValidationFunction. CustomValidatorID. ClientValidationFunction = CustomValidatorID. ClientID + "Your method name"
On the ascx page, the write verification method is function <% = CustomValidatorID. ClientID %> your method name (source, args ){......},
Through the above operations, you can verify the CustomValidator on the client.