Access to Underlying Widgets in ASP.NET MVC

  • 2 minutes to read
TIP

This topic shows the ASP.NET MVC specifics. The main widget customization concepts are described in the following article: Access to Underlying Widgets in DashboardControl.

  • Most dashboard items use DevExtreme UI widgets to visualize data. Use the DashboardControl‘s API to access these widgets and customize their settings. In ASP.NET MVC, you need to subscribe to the ViewerApiExtension events that allow you to access underlying UI/Data Visualization widgets. For this, handle the ASPxClientDashboard.BeforeRender client-side event, call the ViewerApiExtension.on method and pass the event name as the method’s parameter.

  • Several dashboard items use built-in components instead of DevExtreme-based UI widgets.

  • Layout items do not have underlying components.

See the table in the following topic for information about dashboard items and their underlying components: Access to Underlying Widgets in DashboardControl.

Example

The example shows how to customize options of underlying widgets. Handle the onItemWidgetOptionsPrepared event to do the following:

  • Highlight a hovered grid row in the underlying dxDataGrid.
  • Disable a standard tooltip that appears when a user hovers over a chart’s series point.
  • Create a custom tooltip that appears when a user clicks a label on the chart’s argument axis. The onArgumentAxisClick property executes a function that invokes the custom tooltip.
  • Enable the animation for the dxChart and dxPieChart widgets.
  • Display a legend in the dxPieChart widget.

View Example

<script src="~/Scripts/WidgetsCustomization.js"></script>
@Html.DevExpress().Dashboard(settings => {
    settings.Name = "Dashboard";
    settings.Width = Unit.Percentage(100);
    settings.Height = Unit.Percentage(100);
    settings.ClientSideEvents.BeforeRender = "onBeforeRender";
}).GetHtml()