aspnet-5348-components-grid-view-concepts-edit-data-processing-custom-callbacks.md
ASPxGridView enables you to asynchronously process data on the server side using AJAX-based callback technology. To enable callback mode, set the ASPxGridBase.EnableCallBacks property to true. Otherwise, the control uses standard postbacks (which refresh the entire page) to perform round trips to the server.
Custom callbacks enable you to perform required server-side actions. After a custom callback has been performed, ASPxGridView is re-rendered.
Call the ASPxClientGridView.PerformCallback method to send a custom callback to the server. This method generates the server-side ASPxGridView.CustomCallback event. The ASPxClientGridView.PerformCallback method passes the specified argument to the event handler as the Parameters property ( e.Parameters ).
If you need to perform actions on the client side before and after a callback is processed, handle the ASPxClientGridView.BeginCallback and ASPxClientGridView.EndCallback events.
View Example: How to show detail information in a separate ASPxGridView
<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>
function UpdateDetailGrid(s, e) {
detailGridView.PerformCallback();
}
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.
When you develop web applications, you often need to perform specific actions on the server and send the result back to the client for further processing. To make this task easy, ASPxGridView enables you to perform custom data callbacks.
To initiate a custom data callback, use the client-side ASPxClientGridView.GetValuesOnCustomCallback method. This method generates the server-side ASPxGridView.CustomDataCallback event. The method’s args argument (if specified) is passed to the event handler as the Parameters property.
After the callback is processed in the ASPxGridView.CustomDataCallback event handler, the resulting information can be passed back to the client side’s function, specified by the onCallback parameter. This information is specified by the event’s ASPxGridCustomDataCallbackEventArgs.Result property.
Note
If you modify ASPxGridView settings during a custom data callback, these settings have no effect because ASPxGridView is not re-rendered after a custom data callback.
For an example, see our online demo.