Back to Devexpress

ASPxGridView.CustomCallback Event

aspnet-devexpress-dot-web-dot-aspxgridview-645e923e.md

latest6.0 KB
Original Source

ASPxGridView.CustomCallback Event

Fires when you call the ASPxClientGridView.PerformCallback method and initiate a round trip to the server.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public event ASPxGridViewCustomCallbackEventHandler CustomCallback
vb
Public Event CustomCallback As ASPxGridViewCustomCallbackEventHandler

Event Data

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

PropertyDescription
ParametersGets a string that contains specific information (if any) passed from the client side. Inherited from ASPxGridCustomCallbackEventArgs.

Remarks

The CustomCallback event allows you to process a callback on the server side after you call the client ASPxClientGridView.PerformCallback method.

You can use the ASPxGridCustomCallbackEventArgs.Parameters property to pass additional information from the client to the server side.

Note

  • Don’t export the ASPxGridView’s content on a callback, because ASP.NET does not support sending binary content during a callback.
  • Specify a grid’s ClientInstanceName to access its client-side equivalent.

View Example: How to select/deselect all rows in a group when Grid View data is grouped by one column

Example

This example demonstrates how to use two ASPxGridView instances to show the master-detail data.

The master grid calls the PerformCallback(args) to send a callback to the server when a user changes a focused row. On callback, the detail grid gets data from a data source according to the selected product category in the master grid.

View Example: How to show detail information in a separate ASPxGridView

aspx
<dx:ASPxGridView ID="gvMaster" runat="server" ClientInstanceName="masterGridView" ... >
    <ClientSideEvents FocusedRowChanged="UpdateDetailGrid" />
    ...
</dx:ASPxGridView>

<dx:ASPxGridView ID="gvDetail" runat="server" ClientInstanceName="detailGridView" OnCustomCallback="gvDetail_CustomCallback" ...>
    ...
</dx:ASPxGridView>
js
function UpdateDetailGrid(s, e) {
    detailGridView.PerformCallback();
}
csharp
protected void gvDetail_CustomCallback(object sender, DevExpress.Web.ASPxGridViewCustomCallbackEventArgs e) {
    string categoryId = gvMaster.GetRowValues(gvMaster.FocusedRowIndex, "CategoryID").ToString();
    adsProducts.SelectParameters["CategoryID"].DefaultValue = categoryId;
    gvDetail.DataBind();
}

The animation below shows the result.

Online Examples

View Example: How to edit multiple selected rows in a single edit form

View Example: How to create a custom pager and display a page size item

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CustomCallback event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

asp-net-web-forms-grid-created-at-runtime-switch-data-sources/CS/Solution/Default.aspx.cs#L49

csharp
grid.DataBinding += grid_DataBinding;
grid.CustomCallback += grid_CustomCallback;
phGrid.Controls.Add(grid);

asp-net-web-forms-grid-created-at-runtime-switch-data-sources/VB/Solution/Default.aspx.vb#L51

vb
AddHandler grid.DataBinding, AddressOf grid_DataBinding
AddHandler grid.CustomCallback, AddressOf grid_CustomCallback
phGrid.Controls.Add(grid)

See Also

Callbacks

Process Custom Callbacks

Grid View

Online Example: ASPxGridView - How to change a default editor in FilterRow via FilterTemplate

ASPxGridView Class

ASPxGridView Members

DevExpress.Web Namespace