ASP.NET 2.0 has async pages and async tasks. These will postpone rendering
until the async methods you are calling are returned. Async Pages is for one
asynchrounous call. Async Tasks can coordinate multiple calls.

Look up AddOnPreRenderCompleteAsync for more on Async page.

And PageAsyncTask  for async tasks.



-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Paul Cowan
Sent: Sunday, September 03, 2006 4:58 AM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: [ADVANCED-DOTNET] Calling ASYNC method ASP.NET

Hi,

I am trying to handle a piece of MSMQ asynchronous from a web application.
I have the following piece of code that is in the code behind of a user
control in an eventhandler

 ReloadCart();
 OrderCalculatedHandler resultHandler = new
OrderCalculatedHandler(ResultHandler);
_msmqAdapter.CalculateOrder(_cart, resultHandler); Profile.ShoppingCart =
_cart; RetrieveOrderFromProfile();

The line _msmqAdapter.CalculateOrder(_cart, resultHandler); is the line that
calls the asynchronous method.  resultHandler is function pointer to the
following piece of code:

private void ResultHandler(object sender, MSMQEventArguments<ShoppingCart>
e) {
    _cart = e.Result;
    Profile.ShoppingCart = _cart;
}

The problem being that the method takes a long time to run and the page
finishes processing before an event is raised back to the page.

What can I do to tell the page to wait for the ResultHandler method to
execute?

Thanks
Paul
===================================
This list is hosted by DevelopMentorR  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to