Skip to main content
Tab

ASPxCallback.Callback Event

Fires when a round trip to the server has been initiated by a call to the client ASPxClientCallback.PerformCallback method.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v23.2.dll

NuGet Package: DevExpress.Web

Declaration

public event CallbackEventHandler Callback

Event Data

The Callback event's data class is CallbackEventArgs. The following properties provide information specific to this event:

Property Description
Parameter Gets a string that contains specific information (if any) passed from the client side. Inherited from CallbackEventArgsBase.
Result Gets or sets a string that contains specific information (if any) that needs to be passed to the client side for further processing.

Remarks

The Callback event allows any desired server-side processing to be performed in response to a call to the client ASPxClientCallback.PerformCallback method and any resulting required information to be passed to the client for further processing (if needed).

Specific information passed from the client side can be obtained via the CallbackEventArgsBase.Parameter property. After this information has been processed on the server side, a specific result can be passed back to the client side via the CallbackEventArgs.Result property. The necessary processing can then be performed and completed on the client side in a handler of the client ASPxClientCallback.CallbackComplete event which is passed with the parameter and resulting values through its ASPxClientCallbackCompleteEventArgs.parameter and ASPxClientCallbackCompleteEventArgs.result properties.

Example

function ShowImage(id) {
    if (ASPxCallback1.InCallback()) 
        return;
    document.getElementById('imageCell').innerHTML = 'Loading...';
    ASPxCallback1.PerformCallback(id);
}
protected void ASPxCallback1_Callback(object source, 
    DevExpress.Web.CallbackEventArgs e) {
    string xpath = string.Format("//items/item[@id='{0}']", e.Parameter);
    XmlNode node = XmlDataSource2.GetXmlDocument().SelectSingleNode(xpath);
    if(node != null) {
        LargeImage.ImageUrl = "Images/" + node.Attributes["FileName"].Value;
        LargeImage.AlternateText = node.Attributes["Text"].Value;
        LargeImageText.Text = node.Attributes["Text"].Value; 
    }
    e.Result = ASPxCallback.GetRenderResult(ImagePanel);
}
<dx:ASPxCallback ID="ASPxCallback1" runat="server" OnCallback="ASPxCallback1_Callback">
    <ClientSideEvents CallbackComplete="function(s, e) {
        document.getElementById('imageCell').innerHTML = e.result;
    }" />
</dx:ASPxCallback>
See Also