ASPxCallbackPanel Class
A callback panel control that allows you to update its content on a callback.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v21.1.dll
NuGet Package: DevExpress.Web
Declaration
Remarks
The Callback Panel is a container area that allows you to update its content using an AJAX-based callback technology.
Create a Callback Panel
Design Time
The ASPxCallbackPanel control is available on the DX.21.1: Navigation & Layout toolbox tab in the Microsoft Visual Studio IDE.
Drag the control onto a form and customize the control’s settings, or paste the control markup in the page’s source code.
Note
To properly function, DevExpress controls require that special modules, handlers and options are registered in the the Web.config file. Switch the Microsoft Visual Studio IDE to the Design tab to automatically update the Web.config file with the required DevExpress information.
<dx:ASPxCallbackPanel ID="ASPxCallbackPanel1" runat="server" Width="200px">
<PanelCollection>
<dx:PanelContent runat="server">
<dx:ASPxTextBox ID="ASPxTextBox1" runat="server" Width="170px">
</dx:ASPxTextBox>
</dx:PanelContent>
</PanelCollection>
</dx:ASPxCallbackPanel>
Run Time
protected void Page_Load(object sender, EventArgs e)
{
ASPxCallbackPanel cpanel = new ASPxCallbackPanel();
cpanel.ID = "ASPxCallbackPanel1";
cpanel.Controls.Add(new ASPxTextBox() { ID = "ASPxTextBox1", Text = "Test" });
form1.Controls.Add(cpanel);
}
Client-Side API
The ASPxCallbackPanel’s client-side API is implemented with JavaScript language and exposed by the ASPxClientCallbackPanel object.
Availability | Available by default. |
Client object type | |
Access name | |
Events |
Overview
The following API allows you to manipulate the callback panel on the client side:
The (ASPxClientCallbackPanel.PerformCallback) method - Sends a callback to the server.
The CallbackClientSideEventsBase.BeginCallback event - Allows you to perform custom actions when a callback is sent to the server side.
The ASPxCallbackPanel.Callback event - Allows you to handle a callback on the server side.
The CallbackClientSideEventsBase.EndCallback event - Allows you to perform custom actions when a callback comes from the server side.
Use the ASPxPanelContainerBase.Controls property to access the collection of the ASPxCallbackPanel‘s child controls.
Example
Full example - How to implement a custom loading panel for the ASPxCallbackPanel control
function OnUpdateClick(s, e) { cp.PerformCallback("Update"); }
function OnCancelClick(s, e) { cp.PerformCallback("Cancel"); }
<dx:ASPxCallbackPanel ID="cp" runat="server" ClientInstanceName="cp" OnCallback="cp_Callback">
<PanelCollection>
<dx:PanelContent runat="server" SupportsDisabledAttribute="True">
<dx:ASPxGridView ID="gv1" runat="server" DataSourceID="ads1" KeyFieldName="CategoryID" />
<dx:ASPxGridView ID="gv2" runat="server" DataSourceID="ads2" KeyFieldName="ProductID" />
</dx:PanelContent>
</PanelCollection>
</dx:ASPxCallbackPanel>
<dx:ASPxButton ID="updateBtn" runat="server" Text="Update" AutoPostBack="false">
<ClientSideEvents Click="OnUpdateClick" />
</dx:ASPxButton>
<dx:ASPxButton ID="cancelBtn" runat="server" Text="Cancel" AutoPostBack="false">
<ClientSideEvents Click="OnCancelClick" />
</dx:ASPxButton>AutoGenerateColumns
protected void cp_Callback(object sender, CallbackEventArgsBase e) {
switch (e.Parameter) {
case "Update":
gv1.UpdateEdit();
gv2.UpdateEdit();
break;
case "Cancel":
gv1.CancelEdit();
gv2.CancelEdit();
break;
}
}
Online Demos
Online Examples
ASPxDocumentViewer - How to refresh a control inside an ASPxCallbackPanel
How to reload the ASPxCallbackPanel’s content via a callback
How to conditionally create controls via callbacks using the ASPxCallbackPanel