ICallbackEventHandler changes again

I reported on the change from Beta2 of Visual Studio 2005 to the July CTP in a previous post. According to latest information from Microsoft, the interface will undergo another change for RTM. Here it is from the horse's mouth:

Callbacks enable ASP.NET controls to request data from the server using client script instead of posting back the page. For example, the TreeView control uses callbacks to populate child nodes when the parent node is expanded; this avoids the need to render the complete data hierarchy to the client on the initial page request.

Controls will typically retrieve data from a data source control during callback handling. All data source controls expose an asynchronous interface to data-bound controls, although it is possible for data source controls to be implemented synchronously. Although all built-in ASP.NET data source controls are implemented synchronously, the architecture for data controls supports writing asynchronous data source controls. A good example of an asynchronous data source control might be a WebServiceDataSource control.

Beta 2 Behavior

In Beta 2, data source controls implemented asynchronously do not work from a callback request, because the point at which the callback must be handled happens before the asynchronous completion point in the page request lifecycle. This precludes a data source control like the hypothetical WebServiceDataSource control from being used in a callback scenario. Because data-bound controls cannot determine whether a data source supports asynchronous callbacks, data-bound controls that perform a callback cannot implement special logic for handling asynchronous calls. More generally, any asynchronous callback in an asynchronous-enabled page fails. The failure does not raise an exception, it simply does not work.

RTM Behavior

The ICallbackEventHandler interface now includes an Execute method, which is called after the asynchronous completion point. The following example shows how the Execute method is called:

public interface ICallbackEventHandler
    void RaiseCallbackEvent(string 
    String Execute();

posted @ Monday, August 22, 2005 2:12 PM

Comments have been closed on this topic.