[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Collapse]eXpressApp Framework
 [Expand]Getting Started
 [Expand]Design-Time Features
 [Collapse]Task-Based Help
  [Expand]Business Model Design
  [Expand]Application Model
  [Expand]List Editors
  [Expand]Property Editors
  [Expand]Scheduler and Notifications
  [Expand]Maps Module
  [Collapse]Miscellaneous UI Customizations
    How to: Add a Button to a Detail View Using a Custom View Item
    How to: Add an XAF Mobile Custom Module
    How to: Adjust the Size and Style of Pop-up Dialogs (ASP.NET)
    How to: Adjust the Windows' Size and Style
    How to: Change an Application Logo and Info
    How to: Create a Custom Control Detail Item
    How to: Customize a Window Caption
    How to: Customize ASP.NET Layout Elements Using Custom CSS Classes
    How to: Customize Export Options of the Printing System
    How to: Customize the Conditional Appearance Module Behavior
    How to: Customize Window Status Messages (WinForms)
    How to: Enable High DPI Support in a WinForms Application
    How to: Implement a Custom Messaging Class
    How to: Implement Client-Side Logic in Mobile Applications
    How to: Include an Action to a Detail View Layout
    How to: Raise XAF Callbacks from Client-Side Events and Process these Callbacks on Server
    How to: Set Images and Captions for Enumeration Values
    How to: Show a Custom Window with an Embedded XAF View
    How to: Show a Custom Windows Form
    How to: Use a Custom Plugin in a Mobile Application
    How to: Use a DevExtreme Chart in a Mobile Application
    How to: Use Custom Themes in ASP.NET Applications
  Frequently Asked Questions (FAQ)
 [Expand]API Reference
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Raise XAF Callbacks from Client-Side Events and Process these Callbacks on Server

This topic describes how to raise XAF callbacks from the Client-Side Events and process these events on the server. Use this approach if you cannot use a default control callback to implement a behavior and need to refresh the page or show a popup window.


A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E4087.

Follow the steps below to show a Pivot Grid cell's related objects list when a user clicks this cell. You can use a similar approach with any other web control.

  • In the ASP.NET module project, create a ViewController and implement the CallbackManager property which returns the XafCallbackManager object.

  • Override the OnViewControlsCreated method, access the ASPxPivotGrid control and register a new script for the client-side ASPxClientPivotGrid.CellClick event. To create the script, use the XafCallbackManager.GetScript method with the following parameters:

    Parameter Description
    handlerId The registered handler's identifier. The value must be unique for each handler instance. You can use the Guid.NewGuid or Object.GetHashCode methods to create a unique handlerId value.
    parameters A string value passed from the client side when the XAF callback is called. In this example, the cell's ColumnIndex and RowIndex values are passed. You can pass an empty string if parameters are not required.

    Use the ClientSideEventsHelper.AssignClientHandlerSafe method to register the client-side event handler script and avoid replacing the existing scripts that handle the same client-side event.

  • Implement the IXafCallbackHandler interface in your Controller. To register an XAF callback handler, override the OnViewControlCreated method and call the XafCallbackManager.RegisterHandler method. The first parameter is the handlerId value created earlier. The second parameter is an IXafCallbackHandler object (the current Controller instance).


    • Register an XAF callback handler in the OnViewControlsCreated method, because this method is called before processing each page callback.
    • If the WebApplication.OptimizationSettings.AllowFastProcessListViewRecordActions option is enabled, the OnViewControlsCreated method is not called when you customize the ListViewShowObject and Edit Actions. Refer to the Faster rendering and other performance optimizations for popular Web UI scenarios in XAF KB article for details on how to disable this option.

  • Add the code that the server executes when receiving the XAF callback to the ProcessAction method. For example, obtain the clicked cell's column and row indexes from the passed parameters, retrieve the records that are used to calculate this cell summary, and display these records in the List View.

Is this topic helpful?​​​​​​​