Tab

ASPxCallbackPanel.Callback Event

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

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v20.1.dll

Declaration

public event CallbackEventHandlerBase Callback
Public Event Callback As CallbackEventHandlerBase

Event Data

The Callback event's data class is CallbackEventArgsBase. 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.

Remarks

The Callback event allows any desired server-side processing to be performed in response to a call to the client ASPxClientCallbackPanel.PerformCallback method and the panel's content to be updated as required.

Specific information passed from the client side can be obtained via the CallbackEventArgsBase.Parameter property.

NOTE

The ASPxClientCallbackPanel.BeginCallback and ASPxClientCallbackPanel.EndCallback client events can also be used to perform necessary client actions before and after callback processing.

Examples

The ASPxCallbackPanel control provides a built-in loading panel, however you can implement a custom one. For this purpose, the default panel is hidden by setting the Enabled property to false. The custom panel is implemented using the ASPxLoadingPanel control. The callback panel's BeginCallback and EndCallback client-side events are used to show and hide the loading panel respectively. Additionally, this example demonstrates how to add, modify, and hide controls in the ASPxCallbackPanel control in the Callback event handler.

<style>
    .sendCommentBlock {
        margin: 20px 0;
    }

    .comment {
        border-bottom: 1px dashed #888888;
    }
</style>
<script>
    function SendCommentCallback(s, e) {
        CallbackPanel.PerformCallback();
    };

    function OnBeginCallback(s, e) {
        LoadingPanel.Show();
    };

    function OnEndCallback(s, e) {
        LoadingPanel.Hide();
    };
</script>
<dx:ASPxButton ID="Button" runat="server" Text="Post Comment" AutoPostBack="false">
    <ClientSideEvents Click="SendCommentCallback" />
</dx:ASPxButton> 
<br />
<br />
<dx:ASPxTextBox ID="TextBox" runat="server" Width="170px"></dx:ASPxTextBox>
...
<dx:ASPxCallbackPanel ID="CallbackPanel" ClientInstanceName="CallbackPanel" 
    runat="server"
    CssClass="pnl"
    Width="300px"
    OnCallback="CallbackPanel_Callback"
    OnInit="CallbackPanel_Init">
    <SettingsLoadingPanel Enabled="false" />
    <ClientSideEvents BeginCallback="OnBeginCallback" EndCallback="OnEndCallback" />
    <PanelCollection>
        <dx:PanelContent>
            <dx:ASPxLabel ID="CountLabel" runat="server" Text="Comments Count : "></dx:ASPxLabel>
            <br />
            <br />
            <dx:ASPxLabel ID="NoCommentsLabel" runat="server" Text="No Comments" ForeColor="Gray"></dx:ASPxLabel>
        </dx:PanelContent>
    </PanelCollection>
</dx:ASPxCallbackPanel>
...
<dx:ASPxLoadingPanel ID="LoadingPanel" ClientInstanceName="LoadingPanel"
    runat="server"
    Modal="true"
    HorizontalAlign="Center"
    VerticalAlign="Middle">
    <Image Url="Images/load.gif" Height="50px" Width="50px"></Image>
</dx:ASPxLoadingPanel>
See Also