I have custom validators on the aspx page and user needs to see the error message in summary as soon as they tab out of the control.
To achieve this, I am calling Page_ClientValidate('')
on onblur event of each control. One of the custom validator I have is:
function ValidateCustomerId(oSrc, args) {
var txtCustomerId = document.getElementById(txtCustomerId);
if (txtCustomerId != null) {
var customerId = txtCustomerId.value;
if (!isInteger(customerId)) {
document.getElementById("customerIdAsterik").style.display = 'inline';
args.IsValid = false;
}
else {
document.getElementById("customerIdAsterik").style.display = 'none';
}
}
}
If user enters invalid entry and clicks on Cancel button, server side event is not getting fired untill it is clicked twice. Cancel button already has CausesValidation=false
. I think this behaviour is due to calling on Page_ClientValidate()
on onblur event, otherwise it works fine.
Is there to skip the client validations when they click on cancel button or is there any approach I could take to achieve this.
Similar kind of issue is listed here: http://weblogs.asp.net/gurusarkar/archive/2013/05/30/after-first-postback-why-i-have-to-click-the-button-twice-for-postback-to-occur.aspx
Not sure if that applies but the Validation is fired due to the onblur.
So I think setting that Page_Block=false in the button click might work.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments