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

Declaring Server-Side Event Handlers

Certain DevExpress ASP.NET MVC extensions expose event-driven functionality, allowing you to respond to certain stages of component creation and rendering. By handling these events, which are based on the delegate model, you can control and customize the default rendering of an extension.

The code example below demonstrates how to define the server event handler. In this example, the Menu's MenuSettingsBase.ItemDataBound event is processed.

View:

Expanded Accessing the Wrapped ASP.NET WebForms Control

The DevExpress ASP.NET MVC extensions are the wrappers of DevExpress ASP.NET WebForms controls. These wrappers are designed to follow the MVC pattern and seamlessly integrate into ASP.NET MVC projects.

When a DevExpress ASP.NET MVC extension is configured and bound to data (if available), the extension's instance is represented by the MVCx[ExtensionName] class. This class is a descendant of the corresponding DevExpress ASP.NET WebForms control, for example, the MVCxGridView class is a descendant of ASPxGridView.

You can access the wrapped control by handling the SettingsBase.PreRender or the SettingsBase.Init server event. The event sender is the corresponding MVCx[ExtensionName] object. Using the MVCx[ExtensionName] objects can be useful for modifying extension behavior if the behavior depends on data items displayed within the extension. If extension behavior does not depend on data, it is recommended that you modify the behavior using the [ExtensionName]Settings object.

Example

The code sample below demonstrates how to access the MVCxGridView object and expand the first detail row when the grid is initially displayed in a page.

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