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

Client-Side API

The majority of DevExpress ASP.NET MVC extensions offer an advanced client-side API. This enables you to develop more efficient web applications by combining server-side and client-side processing.

The client-side API exposed by DevExpress extensions is implemented using JavaScript - an object oriented programming language which is interpreted by client browsers. JavaScript files that implement the client API are embedded as resource files into extension-relative assemblies (DLLs).

Expanded Attaching Scripts

To work properly, the DevExpress Extensions require the script files implementing their client API to be attached.

If you create your MVC web application using a DevExpress Project Template, the code that attaches the required JavaScript files is automatically added to the application's Site.Master page. If you don't use the DevExpress project template, you need to manually attach necessary DevExpress client script files using the ExtensionsFactory.RenderScripts extension method within a view page's HEAD or BODY tag. Typically, this can be done within the Site.Master page to attach scripts centrally in a single location.

View (or Master Page) Code (ASPX):

View (or layout View) Code (Razor):

Expanded Client API Availability for an Extension

If you write custom client code using the public client-side API provided by a DevExpress MVC extension, make sure that the EnableClientSideAPI property (available as an extension settings object's EnableClientSideAPI or Properties.EnableClientSideAPI for data editors) is set to true. Enabling this property guarantees that the service JavaScript code that implements the extension's client API will be sent to the client browser when a web application that uses the extension is run. This makes the extension's client-side API available for developers.

Some DevExpress MVC Extensions provide the public client-side API, but do not expose the EnableClientSideAPI property. This means that client-side API is always available for these extensions on the client.

Note that an extension's client API becomes available automatically if any of its client-side events (available via the ClientSideEvents property of extension settings) is handled.

Expanded How to Access an Extension on the Client

An extension client object can be accessed on the client using the extension name defined using the SettingsBase.Name property.

View code (ASPX):

View code (Razor):

Note

If the SettingsBase.Name property contains special characters, use the approach described in the following Knowledge Base Article to access the client-side programmatic object.

KA18687: How to use the ClientInstanceName and Name properties when they contain special characters

Expanded Client-Side Events

DevExpress MVC Extensions expose a number of client events, allowing you to promptly respond to end-user manipulations without server processing.

Extension specific client events can be accessed using the ClientSideEvents property. It is available through an extension setting object (such as MenuSettingsBase.ClientSideEvents) or through the properties object related to a settings object (such as Properties.ClientSideEvents which is TextBoxSettings.Properties -> TextBoxProperties.ClientSideEvents for TextBox) for data editors.

The following code demonstrates how client events can be handled - by implementing a separate function (for the Menu's ItemClick event) or directly within the markup (for the Button's Click event).

View code (ASPX):

View code (Razor):

See Also: Client-Side Events of DevExpress ASP.NET Controls

Expanded Client API Implementation

The table below lists the DevExpress MVC Extensions together with their client counterpart objects and the corresponding namespaces that implement their client-side functionalities.

Extension Name Client Object Client Namespace
GridView MVCxClientGridView DevExpress.Web.MVC.Scripts,
DevExpress.Web.Scripts
PivotGrid MVCxClientPivotGrid DevExpress.Web.MVC.Scripts,
DevExpress.Web.ASPxPivotGrid.Scripts
TreeList MVCxClientTreeList DevExpress.Web.MVC.Scripts,
DevExpress.Web.ASPxTreeList.Scripts
HtmlEditor MVCxClientHtmlEditor DevExpress.Web.MVC.Scripts,
DevExpress.Web.ASPxHtmlEditor.Scripts
Navigation Extensions:    
Menu ASPxClientMenu DevExpress.Web.Scripts
NavBar MVCxClientNavBar DevExpress.Web.MVC.Scripts,
DevExpress.Web.Scripts
PageControl MVCxClientPageControl DevExpress.Web.MVC.Scripts,
DevExpress.Web.Scripts
PopupControl ASPxClientPopupControl DevExpress.Web.Scripts
Splitter ASPxClientSplitter DevExpress.Web.Scripts
TabControl ASPxClientTabControl DevExpress.Web.Scripts
TreeView MVCxClientTreeView DevExpress.Web.MVC.Scripts,
DevExpress.Web.Scripts
Data Editors Extensions:    
BinaryImage ASPxClientBinaryImage DevExpress.Web.Scripts
Button ASPxClientButton DevExpress.Web.Scripts
ButtonEdit ASPxClientButtonEdit DevExpress.Web.Scripts
Calendar MVCxClientCalendar DevExpress.Web.MVC.Scripts,
DevExpress.Web.Scripts
CheckBox ASPxClientCheckBox DevExpress.Web.Scripts
CheckBoxList ASPxClientCheckBoxList DevExpress.Web.Scripts
ColorEdit ASPxClientColorEdit DevExpress.Web.Scripts
ComboBox MVCxClientComboBox DevExpress.Web.MVC.Scripts,
DevExpress.Web.Scripts
DateEdit ASPxClientDateEdit DevExpress.Web.Scripts
DropDownEdit ASPxClientDropDownEdit DevExpress.Web.Scripts
HyperLink ASPxClientHyperLink DevExpress.Web.Scripts
Image ASPxClientImage DevExpress.Web.Scripts
Label ASPxClientLabel DevExpress.Web.Scripts
ListBox MVCxClientListBox DevExpress.Web.MVC.Scripts,
DevExpress.Web.Scripts
Memo ASPxClientMemo DevExpress.Web.Scripts
ProgressBar ASPxClientProgressBar DevExpress.Web.Scripts
RadioButton ASPxClientRadioButton DevExpress.Web.Scripts
RadioButtonList ASPxClientRadioButtonList DevExpress.Web.Scripts
SpinEdit ASPxClientSpinEdit DevExpress.Web.Scripts
TextBox ASPxClientTextBox DevExpress.Web.Scripts
TimeEdit ASPxClientTimeEdit DevExpress.Web.Scripts
TokenBox MVCxClientTokenBox DevExpress.Web.MVC.Scripts,
DevExpress.Web.Scripts
TrackBar ASPxClientTrackBar DevExpress.Web.Scripts
Utilities Extensions:    
CallbackPanel MVCxClientCallbackPanel DevExpress.Web.MVC.Scripts,
DevExpress.Web.Scripts
RoundPanel ASPxClientRoundPanel DevExpress.Web.Scripts
UploadControl MVCxClientUploadControl DevExpress.Web.MVC.Scripts,
DevExpress.Web.Scripts
Chart Extension:    
Chart MVCxClientChart DevExpress.Web.MVC.Scripts,
DevExpress.XtraCharts.Web.Scripts
Report Extension:    
DocumentViewer MVCxClientDocumentViewer DevExpress.Web.MVC.Scripts,
DevExpress.XtraReports.Web.Scripts
Scheduler Extension:    
SchedulerControl MVCxClientScheduler DevExpress.Web.MVC.Scripts,
DevExpress.Web.ASPxScheduler.Scripts

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