Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]ASP.NET WebForms Controls
 [Collapse]ASP.NET MVC Extensions
  [Expand]Product Information
  [Expand]Getting Started
  [Collapse]Common Concepts
    Web Application Project Templates
    Insert Extension Wizard
    Data Binding
   [Expand]Applying Themes
    Client-Side API
    Declaring Server-Side Event Handlers
    Templates
    Using Callbacks
    Passing Values to a Controller Action through Callbacks
    Supported Attributes for Model Validation
    Using Extensions in Razor Views
  [Expand]Grid View
  [Expand]Card View
  [Expand]Vertical Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]HTML Editor
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Expand]Navigation and Layout Extensions
  [Expand]File Management
  [Expand]Multi-Use Site Extensions
  [Expand]Charts
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Tree List
  [Expand]Data Editor Extensions
  [Expand]Report Extensions
  [Expand]SpellChecker
 [Expand]Localization
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Using Callbacks

Some DevExpress MVC extensions can work in callback mode by requesting the server via their own callbacks. Using callbacks is an efficient way to load/update extension content on demand (to minimize the initial data transfer) or to perform some lengthy functional operations (such as file uploads).

The following requirements should be met for an extension that is used in callback mode.

  • An extension should be defined in a separate Partial View (.cshtml or .vbhtml).

    Note

    It is required that a Partial View contains only the extension definition code, without any additional markup.

  • A Controller should contain an additional Action method to handle extension callbacks and route them directly to a Partial View containing the extension. This allows the extension render to be conditionally updated in response to the end-user action performed.
  • Callback routing logic should be defined using a CallbackRouteValues property of an extension's settings object. This property allows the names of the callback handling Controller and Action to be specified.

Note that these requirements are not required for all extensions that support the use of callbacks. For instance, the UploadControl extension might not be declared within a Partial View - it is enough for it to properly implement a callback handler Action method and reference this method in the CallbackRouteValues property's value.

Expanded Extensions That Can Use Callbacks

The table below lists DevExpress MVC extensions that support the use of callbacks.

Extension Callback Mode Availability Requirements for Callback Mode Realization
Calendar Optional Define extension in a separate Partial View.
Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (CalendarSettings.CallbackRouteValues)
CallbackPanel Always Define extension in a separate Partial View.
Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (CallbackPanelSettings.CallbackRouteValues)
Charts Optional Define extension in a separate Partial View.
Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (ChartControlSettings.CallbackRouteValues)
ComboBox Optional Define extension in a separate Partial View.
Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (AutoCompleteBoxBaseSettings.CallbackRouteValues)
DataView Always Define extension in a separate Partial View.
Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (DataViewSettings.CallbackRouteValues)
DateEdit Optional Define extension in a separate Partial View.
Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (DateEditSettings.CallbackRouteValues)
DockManager Optional Define extension in a separate Partial View.
Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (DockManagerSettings.CallbackRouteValues)
DockPanel Optional Define extension in a separate Partial View.
Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (PopupControlSettingsBase.CallbackRouteValues)
DocumentViewer Always Define extension in a separate Partial View.
Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (ReportViewerSettings.CallbackRouteValues)
GridView Always Define extension in a separate Partial View.
Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (GridSettingsBase.CallbackRouteValues)
HtmlEditor Always Define extension in a separate Partial View.
Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (HtmlEditorSettings.CallbackRouteValues)
ListBox Optional Define extension in a separate Partial View.
Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (ListBoxSettings.CallbackRouteValues)
Menu Optional Define extension in a separate Partial View.
Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (MenuSettings.CallbackRouteValues)
NavBar Optional Define extension in a separate Partial View.
Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (NavBarSettings.CallbackRouteValues)
PageControl Optional Define extension in a separate Partial View.
Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (PageControlSettings.CallbackRouteValues)
PivotGrid Always Define extension in a separate Partial View.
Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (PivotGridSettings.CallbackRouteValues)
PopupControl Optional Define extension in a separate Partial View.
Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (PopupControlSettingsBase.CallbackRouteValues)
PopupMenu Optional Define extension in a separate Partial View.
Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (PopupMenuSettings.CallbackRouteValues)
RichEdit Always Define extension in a separate Partial View.
Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (RichEditSettings.CallbackRouteValues)
Scheduler Always Define extension in a separate Partial View.
Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (SchedulerSettings.CallbackRouteValues)
Spreadsheet Always Define extension in a separate Partial View.
Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (SpreadsheetSettings.CallbackRouteValues)
TreeList Always Define extension in a separate Partial View.
Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (TreeListSettings.CallbackRouteValues)
TreeView Optional Define extension in a separate Partial View.
Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (TreeViewSettings.CallbackRouteValues)
UploadControl Optional Implement an Action method within the Controller to handle extension callbacks.
Specify the Controller and Action names via the CallbackRouteValues property. (UploadControlSettings.CallbackRouteValues)

Expanded Example

This example demonstrates how the use of callbacks can be implemented for the TreeView extension.

View Code - "Callbacks" (ASPX)

View Code - "Callbacks" (Razor)

PartialView code - "CallbacksPartial" (ASPX):

PartialView code - "CallbacksPartial" (Razor):

Controller ("TreeViewController"):

Expanded See Also

How would you rate this topic?​​​​​​​