MESCIUS.ActiveReports.Viewer.Common Assembly / GrapeCity.Viewer.Common.Model.Interactivity Namespace / IAction Interface
Members Example

IAction Interface
Defines a contract for actions that can be performed on report items.
Object Model
IAction Interface
Syntax
'Declaration
 
Public Interface IAction 
 
Remarks
Implementations of this interface represent different types of actions that can be associated with report items, such as navigating to a URL, jumping to a bookmark within the report, executing a drillthrough report, or applying report parameters. These actions are typically triggered by user interactions with the report content.
Example
// Create an instance of Viewer
var viewer = new GrapeCity.ActiveReports.Viewer.Win.Viewer();
// Add an event handler for the Action event
viewer.Action += (sender, e) =>
{
  switch (e.Action)
  {
    case (HyperlinkAction hyperlinkAction):
      try
      {
        // Open the browser with the specified URL
        Process.Start(new ProcessStartInfo
        {
          FileName = hyperlinkAction.Url,
          UseShellExecute = true
        });
      }
      catch (Exception ex)
      {
        Console.WriteLine("An error occurred: " + ex.Message);
      }
      finally
      {
        e.Cancel = true;
      }
      break;
    case (DrillthroughAction drillthroughAction):
      // Show dialog for DrillthroughAction
      MessageBox.Show($"Drill through to: {drillthroughAction.TargetReport.LoadState}", "DrillThrough Action", MessageBoxButtons.OK);
      break;
    case (BookmarkAction bookmarkAction):
      // Show dialog for BookmarkAction
      MessageBox.Show($"Navigate to Bookmark: {bookmarkAction.TargetPage}", "Bookmark Action", MessageBoxButtons.OK);
      break;
    case (ApplyParametersAction applyParametersAction):
      // Show dialog for ApplyParametersAction
      var parameters = string.Join(", ", applyParametersAction.Parameters);
      MessageBox.Show($"Apply Parameters: {parameters}", "ApplyParameters Action", MessageBoxButtons.OK);
      break;
  }
};
// Load a report with a hyperlink action and other actions
viewer.LoadDocument("report.rdlx");
See Also