Handling Client-side Scripts

  • 2 minutes to read

This topic describes the ASP.NET Chart Control’s client-side scripting feature, and demonstrates an easy way to access client-side events.

The WebChartControl supports the AJAX technology, which implements end-user interaction with callbacks rather than standard postbacks. Callbacks get only a specific set of data through targeted round trips to the server, so the entire web page does not need to be refreshed when a page changes. This reduces traffic and increases the performance of your web application. With the Web Chart Control, implementation of client-side scripts is made as easy as possible.

To quickly handle a client-side event, click the WebChartControl’s smart tag, and choose Client Side Events… in the invoked Tasks list. Or, in the Properties window, expand the WebChartControl.ClientSideEvents property and click the ellipsis button for the required event.

ClientSide_0

In the invoked WebChartControl Designer, write the JavaScript code (or names of the JavaScript handle functions) for the required events.

ClientSide_1

The ChartClientSideEvents class contains the list of available client-side events.

In these event handlers, call the ASPxClientWebChartControl.GetChart method to access a chart’s client-side equivalent (an ASPxClientWebChart object). Then, you can access its main elements (diagram, panes, axes, etc.) and their properties.

Note that the following properties may affect the performance of your web application, so you should use them carefully.

See Also