Dundas Chart for ASP.NET
GetCallbackAsyncMethodReference Method
See Also  Example Send comments on this topic.
Dundas.Charting.WebControl Namespace > ChartCallbackManager Class : GetCallbackAsyncMethodReference Method


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
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 (Declaration)  
Public Function GetCallbackAsyncMethodReference( _
   ByVal command As String, _
   ByVal arguments As String _
) As String
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)
C#  
public string GetCallbackAsyncMethodReference( 
   string command,
   string 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
 ' Random value;
Private r As New Random()


'/ <summary>
'/ Page Load event handler.
'/ </summary>
Protected Sub Page_Load(sender As Object, e As System.EventArgs)

   ' lets only series to be serialized.
   Me.Chart1.CallbackStateContent = CallbackStateContent.SeriesDataOnly

   ' Define the callback event.
   AddHandler Me.Chart1.Callback, AddressOf Chart1_Callback

   ' Register page startup script that will be executing chart callback command every second
   Me.Page.ClientScript.RegisterStartupScript(GetType(Chart), "callback", "window.setInterval(""" + Me.Chart1.CallbackManager.GetCallbackAsyncMethodReference("Timer", "") + """, 500);", True)
End Sub 'Page_Load


'/ <summary>
'/ Chart Callback event handler.
'/ </summary>
Protected Sub Chart1_Callback(sender As Object, e As CommandEventArgs)
   If e.CommandName = "Timer" Then

      ' Change the chart background color.
      Chart1.BackColor = Color.FromArgb(r.Next(255), r.Next(255), r.Next(255))

   End If
End Sub 'Chart1_Callback
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

Copyright © 2001 - 2009 Dundas Data Visualization, Inc. and others.