tricky postback problem...

  • Thread starter Thread starter Sharon McCarty
  • Start date Start date
S

Sharon McCarty

Hi there,

I have a textbox and a save button in an aspx page. I have the
textbox event handler, TextChanged, hooked up to the textbox which
calls a vendor's api. The event handler method finishes processing
after a good 3 seconds. THe problem is that the user may click on the
save button during the processing part. I would like to disable the
save button during the duration of the eventhandler.

Is there a way to do this? I'm starting to think this might be
impossible. I've tried fooling around the prerender and onload
methods. Prerender and onload method are called before the button is
clicked but when i try to disable the button, it does not work until
the eventhandler is finished.


Thanks in advance!

Sharon
 
Sharon,

The problem is that for the button to be disabled on the PreRender or
OnLoad you have to go to the server and come back. There area few
solutions to the problem. I think the following link may help. You can
just show a progress page while the API is processing.

http://www.eggheadcafe.com/articles/20050108.asp

Have fun.
 
If you add something along the lines of (replacing the control names as
appropriate):
TextBox1.Attributes["onchange"] = "document.Form1.Button1.disabled =
true; ";

to your Page_Load handler, the client side onchange event should include the
code to disable the button (above code) plus the auto generated
__doPostBack(...) call.
HTH
 
Back
Top