How do I hook up javascript to my CustomValidator control in .Net

前端 未结 3 1544
没有蜡笔的小新
没有蜡笔的小新 2021-01-28 12:30

I have created a CustomValidator control

public class MyValidator :CustomValidator, IScriptControl {}

and also created the equivalent client sc

3条回答
  •  长情又很酷
    2021-01-28 13:23

    Actually much easier is to use the ClientValidationFunction property of the asp:CustomValidator like below. Be sure NOT to specify a ControlToValidate property.

    
    
    function MyCustomJSFunction(validator, args) {
        args.IsValid = my condition;
    }
    

提交回复
热议问题