In case of button click, Page_ClientValidate()
is called when (and only when) the button's CausesValidation
is set to true
.
Page_ClientValidate()
is part of process of doing postback, so it is called within button's click.
I rely on Page_IsValid
only in a scope of a function after calling Page_ClientValidate()
. Otherwise I always call Page_ClientValidate()
.
Comment: calling Page_ClientValidate()
repeatedly may cause the page to be too obtrusive (multiple alerts etc.). That's why it's good to have a custom validate function that takes care of all validation.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…