Handling Client-side Scripts
- 2 minutes to read
This document describes the specifics of client-side scripting with the ASP.NET Chart Control. It demonstrates an easy way to access the available client-side events, and gives a general overview of nuances that are characteristic for ASP.NET platform.
The WebChartControl supports the AJAX technology, allowing you to implement end-user interaction using callbacks, rather than standard postbacks (when the whole page is refreshed in reaction to any change made in a web page). Callbacks provide targeted round trips to server, allowing you to reduce the traffic, and increase 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 smart tag of your WebChartControl, and in its actions list, choose the Client Side Events... link. Or, in the Properties window, expand the WebChartControl.ClientSideEvents property, and click the ellipsis button for the required event.
The ChartClientSideEvents class contains the list of available client-side events.
In these event handlers, a chart's client-side equivalent (represented by an ASPxClientWebChart object) is accessed by calling the ASPxClientWebChartControl.GetChart method. Then, you can get access to its main elements (diagram, panes, axes, and so on), and their properties.
Note that the following properties may affect the performance of your web application, so you should use them carefully.
Use the WebChartControl.EnableCallBacks property, to specify whether the callback or postback technology is used to manage round trips to the server.
When the WebChartControl is to be used within an ASPxCallbackPanel, the WebChartControl.EnableCallBacks property should be disabled. For more information on this, refer to How to: Add a Chart to an ASPxCallbackPanel during its Callback (Runtime Sample).
- Use the WebChartControl.EnableCallbackCompression property, to apply compression to the callbacks. This option may boost the client-server interaction, when large numbers of callbacks are performed.