Wednesday, March 28, 2012

Ajax Update Panel

Hi guys,

I am using a login page with ValidatorCalloutExtender controls to validate username and password textboxes. On the submit button, I am using UpdateProgress to display an animation while the request is being entertained. Now, when the button's pressed, the animation comes up properly and everything is ok. However, I want the button to be disabled while the "progress" animation is being played and as soon as the results come back (like account not found), I want the button to be enabled again for the user.

How can I switch between the 2 states of the button as above? I would appreciate all help.

Thanks!

Found the solution :)

<scriptlanguage=javascript>

Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

function BeginRequestHandler(sender, args)

{

var btn = document.getElementById("<%= BtnSubmit.ClientID %>");btn.disabled =true;

}

function EndRequestHandler(sender, args)

{

var btn = document.getElementById("<%= BtnSubmit.ClientID %>");btn.disabled =false;

}

</script>

No comments:

Post a Comment