Disable button while processing

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Aubyone

    #1

    Disable button while processing

    Does any one know if there is a way to disable Button on the web page while
    the page is proceessing the command on the Server?

    To stop user clicking buttons once it has started a process.
  • Tasos Vogiatzoglou

    #2
    Re: Disable button while processing

    You should use a little trick for that as you cannot have a direct
    indication that server is busy. That is, when the user presses the
    button you disable it (using some client side code), so the user cannot
    click again the button.

    In the Page_Load method use the following (assuming your button is
    called btn)

    btn.Attributes["onclick"]=string.Format( "{0}.disabled=t rue;{1};",btn.U niqueID,GetPost BackEventRefere nce(btn));


    Regards,
    Tasos

    Comment

    Working...