Obtains a reference to a client-side function that, when invoked, initiates a client call back to a server-side event which is handled by the Chart. The call will be asynchronous, the browser event will not be passed, and event bubbling will not be canceled.
Obtains a reference to a client-side function that, when invoked, initiates a client call back to a server-side event which is handled by the Chart. The call will be asyncronous and the browser event will not be passed and event bubbling will not be canceled.
Syntax
Visual Basic (Usage) |
Copy Code |
Dim instance As ChartCallbackManager
Dim command As String
Dim arguments As String
Dim value As String
value = instance.GetCallbackAsyncMethodReference(command, arguments)
|
Parameters
- command
- The control which handles the arguments.
The control which handles the arguments
- arguments
- String which is passed to the targetControl.
String which is passed to the targetControl
Return Value
String which represents javascript function.
String which represents javascript function.
Example
This example demonstrates how to set a callback command to execute every second using the GetCallbackAsyncMethodReference. This example assume you have added a chart at design-time.
Visual Basic |
Copy Code |
Private r As New Random()
Protected Sub Page_Load(sender As Object, e As System.EventArgs)
Me.Chart1.CallbackStateContent = CallbackStateContent.SeriesDataOnly
AddHandler Me.Chart1.Callback, AddressOf Chart1_Callback
Me.Page.ClientScript.RegisterStartupScript(GetType(Chart), "callback", "window.setInterval(""" + Me.Chart1.CallbackManager.GetCallbackAsyncMethodReference("Timer", "") + """, 500);", True) End Sub
Protected Sub Chart1_Callback(sender As Object, e As CommandEventArgs) If e.CommandName = "Timer" Then
Chart1.BackColor = Color.FromArgb(r.Next(255), r.Next(255), r.Next(255))
End If End Sub |
C# |
Copy Code |
// Random value; private Random r = new Random();
/// <summary> /// Page Load event handler. /// </summary> protected void Page_Load(object sender, System.EventArgs e) {
// lets only series to be serialized. this.Chart1.CallbackStateContent = CallbackStateContent.SeriesDataOnly;
// Define the callback event. this.Chart1.Callback += new CommandEventHandler(Chart1_Callback);
// Register page startup script that will be executing chart callback command every second this.Page.ClientScript.RegisterStartupScript( typeof(Chart), "callback", "window.setInterval(\"" + this.Chart1.CallbackManager.GetCallbackAsyncMethodReference("Timer", "") + "\", 500);", true); }
/// <summary> /// Chart Callback event handler. /// </summary> protected void Chart1_Callback(object sender, CommandEventArgs e) { if (e.CommandName == "Timer") { ' Change the chart background color. Chart1.BackColor = Color.FromArgb(r.Next(255), r.Next(255), r.Next(255)); } } |
Requirements
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family
See Also