Documentation for: ASP.NET Ajax Version 1.0

This documentation is for a previous version. For the current released version, see the ASP.NET Ajax documentation on MSDN.

 

 

 

 

 

 

 

Generated Proxy Classes defaultFailedCallback Property

Gets or sets the default failed callback function for the generated proxy class and its instances. This property exists at run time after the proxy class has been generated by the server.

note

To get or set property values for client API properties, you must call property accessor methods that are named with the get_ and set_ prefixes. For example, to get or set a value for a property such as cancel, you call the get_cancel or set_cancel methods.

Syntax

// Syntax for a static proxy class.
var failedCallback = 
    MyNameSpace.MyServiceProxy.get_defaultFailedCallback(); 
MyNameSpace.MyServiceProxy.set_defaultFailedCallback(handler);

// Syntax for a proxy instance.
var failedCallback = myServiceProxy.get_defaultFailedCallback(); 
myServiceProxy.set_defaultFailedCallback(handler); 

Parameter

Description

handler

The failed callback function.

Return Value

The failed callback function, if one has been set; otherwise, null.

Remarks

The failed callback function is invoked when a call to a Web service method fails.

The failed callback function can be passed as a parameter during any call to a Web service method. If you pass a failed callback function when you call a Web service method, the passed function overrides the function that is set by using the defaultFailedCallback property.

Example

The following example shows how to set and get the defaultFailedCallback property for the generated proxy class and for a proxy instance.

javascript

// This function sets and gets the default failed 
// callback function for the Web service generated 
// proxy class.
function AssignFailedCallback() 
{
    // Set the default callback.
    Samples.AspNet.UsingProxyClass.set_defaultFailedCallback(FailedCallback);

    // Get the default callback.
    var callback = 
        Samples.AspNet.UsingProxyClass.get_defaultFailedCallback();

    // Display the callback.
    DisplayMessage(callback);
}

javascript

// This function sets and gets the default failed 
// callback function for an instance of the Web service 
// generated proxy class.
function AssignInstanceFailedCallback() 
{ 
   // Create an instance of the proxy class.
    var proxyInstance = 
        new Samples.AspNet.UsingProxyClass();

    // Set the default callback.
    proxyInstance.set_defaultFailedCallback(FailedCallback);

    // Get the default callback.
    var callback = proxyInstance.get_defaultFailedCallback();

    // Display the callback.
    DisplayMessage(callback);
}