How to know Page.IsValid on Client Side in Asp.net.
Generally you never run into this scenario, but it is important in case you are doing something which i tried to do.
I was trying to disable Submit button as soon as user press it, in order to avoid multiple button click.
What if error occurred, Validation control on client side will never call server-side function and so our button which was disable, will remain disable. To overcome, this problem, we need to identify whether Page is error free on client-side.
To find Page.IsValid on Client Side, simply check this on Disable Submit Button Javascript
{
}
Example: Disable Submit Button Javascript Function
function DisableClickUploadArticle() {
var objName = 'btnUploadArticle';
if (Page_IsValid) {
document.getElementById(objName).disabled = true;
a = a + 1;
msg = 'Please Wait...(' + a + ')!';
document.getElementById(objName).value = msg;
var t = setTimeout('DisableClickUploadArticle()', 1000);
}
else {
document.getElementById(objName).disabled = false;
document.getElementById('PleaseWaitUploadArticle').style.display = 'none';
document.getElementById(objName).value = "Submit Article";
}
}
No comments:
Post a Comment