ActiveReports 6 Online Help
Customizing the Flash Viewer UI
Show AllShow All
Hide AllHide All

You can customize the Flash Viewer UI, using javascript functions. This walkthrough illustrates how to customize the look and feel of the Flash Viewer.

The walkthrough is split up into the following activities:

To follow the steps of this walkthrough, you must first complete the steps on creating an ASP.NET Web site and setting up the FlashViewer, described in the Flash Viewer walkthrough.

To customize the Flash Viewer options

  1. Select the WebViewer on your .aspx page, and in the Properties window, expand the FlashViewerOptions node.
  2. Set the property UseClientApi (FlashViewerOptions) to True (this property is set to False by default).
  3. Declare a variable and attach the FlashViewer by adding the following code onto the .aspx Source view.

    Paste the code into the Source view of .aspx inside the <head> and </head> tags
    Copy Code
    <script language="javascript" type="text/javascript">
    var viewer;
    
    function init() {
     DataDynamics.ActiveReport.Viewer.OnLoad ("WebViewer1", function() {
      viewer = DataDynamics.ActiveReport.Viewer.Attach("WebViewer1");
     });
    }
    </script>                                
    
    Replace the <body> tag on the Source view of .aspx
    Copy Code
    <body onload="return init()">
    
  4. Drag the Html Input (button) control from the Visual Studio toolbox onto the .aspx design view, containing the WebViewer control.

  5. Double-click the Button control and paste the following code:

    Paste the code into the Source view of .aspx inside the <script> and </script> tags
    Copy Code
    function Button1_onclick() { 
            var zoom = viewer.getZoom(); 
                    alert("Check that zoom property is changed from " + zoom); 
                    zoom += 0.1; 
                    viewer.setZoom(zoom);
                    alert("to " + zoom);
    }
    

    Note: You can declare a variable and attach the FlashViewer in the event handler directly. This would replace the actions in the step 3 above.

    Paste the code into the Source view of .aspx inside the <script> and </script> tags
    Copy Code
    function Button1_onclick()
    {
    var viewer;
    viewer = DataDynamics.ActiveReport.Viewer.Attach("WebViewer1");
    ...
    }
    

Available Flash Viewer properties

Available Flash Viewer methods

To handle Flash Viewer Events

  1. Declare a variable, attach the Flash Viewer and add event handlers by adding the following code onto the .aspx Source view.
Paste the code into the Source view of .aspx inside the <head> and </head> tags
Copy Code
<script language="javascript" type="text/javascript">
var viewer;
function init() {
DataDynamics.ActiveReport.Viewer.OnLoad("WebViewer1", function() {
viewer = DataDynamics.ActiveReport.Viewer.Attach("WebViewer1");
    viewer.setEventsHandler({
        OnLinkClick: function(e) {
            alert(e.Link); //specifies url of the link item, string
            return true;
        },
        OnError: function(e) {
            alert(e.Message); //error message, string
            alert(e.ErrorType); //possible types are "Error" and "Warning", string
            return false;
        }
    });
});
}
</script>
Replace the <body> tag on the Source view of .aspx
Copy Code
<body onload="return init()">
Note: <EVENTS> are described in detail in the Available events list below.

Available events

Note: Use the "return true;" value to show that the client side has handled the event. The "return false;" value indicates that the event was not handled.
See Also

Walkthroughs

How To

Getting Started