User Control With Client + Server Side Customvalidation; Wrong Client Side Validator Is Picked
I have a user control which contains a CustomValidator which is used according to whether a RadioButton is checked or not (there are several RadioButtons, I'm only showing the rele
Solution 1:
Your client validation function is generated with the same name for both your user controls. There will be twoValidateDateFields_Client()
functions in your page, and of course the interpreter will only call one of them.
One way to work around that problem would be to generate unique function names:
<script type="text/javascript">
functionValidateDateFields_Client_<%=RadioBetween.ClientID%>(source, args)
{
// ...
}
</script>
<asp:CustomValidatorID="DateValidator"runat="server"Display="Dynamic"ClientValidationFunction="ValidateDateFields_Client_"OnServerValidate="ValidateDateFields"></asp:CustomValidator>protectedvoidPage_PreRender(object sender, EventArgs e)
{
DateValidator.ClientValidationFunction += RadioBetween.ClientID;
}
Post a Comment for "User Control With Client + Server Side Customvalidation; Wrong Client Side Validator Is Picked"