Wednesday, October 14, 2009

Check Page.IsValid at Client Side using C#

when i was designing a registration form i run into this case, what i want is if user press register
button, then that button get disable to avoid multiple click on registration button.

now if error occurred on the client side never call any server-side function so in this case the disable button will remain disable as it is, now to overcome

such problem we have to identify whether Page is error free on the client-side.

To find out this simply check on Disable Submit Button.

//write your code here.

function DisableClick() {
var obj = 'btnUpd';
if (Page_IsValid) {
document.getElementById(obj).disabled = true;
txt = txt + 1;
message = 'Please Wait......(' + txt + ')!';
document.getElementById(obj).value = message;
var t = setTimeout('DisableClick()', 600);
document.getElementById(obj).disabled = false;
document.getElementById('PleaseWait').style.display = 'none';
document.getElementById(obj).value = "Register";

hope it will work you,

1 comment: