469,917 Members | 1,828 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,917 developers. It's quick & easy.

How to make the Click event of a Button to deal with an asynchronous remote service


I have a remote service executing notoriously asynchronously which I must be
able to use from my Compute_Click(...) event handler. The WebForm I have
contains only two controls: A Compute button and a Result textbox. I may
easily start the asynchronous execution in the Compute_Click event handler.
The asynchronous service notifies me when it's result is ready, the
notification is done by a delegate invoking ResultReady(...). My problem is,
that ASP.NET sends the page back to the client as soon as the last line in
Compute_Click() has been executed, but actually I would like to make the
page go to the server after the last line of ResultReady() instead. So my
question is, how to tell ASP.NET that the page is not ready after the last
line in Compute_Click() but ready after the last line of ResultReady()?
Best regards,

Henrik Dahl
Nov 18 '05 #1
1 1215

You can create Class that handles all of that work for you. Your class
implements public function that you will call from your page, two
private functions and private inner state member. One private function
starts async call and the second receive the async callback. Receiving
async call function will change private state member when data arrived.
Class public function call the first function and wait until inner class
state member changed or certain timeout interval elapse.

If your async work extends the default web call timeout you should
consider other solution

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-8883777
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.