hide control while async post back ?

Last post 11-19-2008 1:10 PM by fanindrabhortakke123. 2 replies.

Sort Posts:

  • hide control while async post back ?

    11-19-2008, 4:54 AM

    Hi All,

     I have a dropdown(autopostback) and button in update panel . when I change value in dropdown it postback and take some time whitin that time use can click on button. I want to restrict user to click on button.

    Is it possible to hide that button duting async postback.

     suggest something,

    Thanks in advance...

  • Re: hide control while async post back ?

    11-19-2008, 10:10 AM
    Answer
    • Member
      564 point Member
    • windsorguy13
    • Member since 02-21-2006, 1:22 PM
    • Posts 87

     You'll want to do this using javascript, but it's pretty easy. I'd lean towards disabling the button rather than hiding it though. The following code should help get you started:

     

     var prm = Sys.WebForms.PageRequestManager.getInstance();
     prm.add_endRequest(EndRequestHandler);
     prm.add_beginRequest(BeginRequestHandler);
     
     function BeginRequestHandler()
     {
       $get('YOURBUTTONID').disabled = true;
     }
    
     function EndRequestHandler()
     {
       $get('YOURBUTTONID').disabled = false;
     }

      

    The basic idea is that when the async postback starts, the BeginRequestHandler gets called, so you disable the button. When the async postback completes the EdnRequest handler gets called. You wire these up on lines 2, and 3 using the PageRequestManager.

    Please remember to mark this post as the answer if it helps!

    Thanks!

    -Brian

    Don't forget to click "Mark as Answer" if this helped you.
  • Re: hide control while async post back ?

    11-19-2008, 1:10 PM

    Thanks Brian,

    it really helped to solve my problem...your solution is working..

     

Page 1 of 1 (3 items)