[]
Occurs when a report item, configured with an interactive action, is clicked within the report preview control.
public event EventHandler<Viewer.ActionEventArgs> Action
Type | Description |
---|---|
EventHandler<Viewer.ActionEventArgs> | Occurs when a report item, configured with an interactive action, is clicked within the report preview control. |
This event is raised in response to user interactions with report items that have associated actions, such as hyperlinks or drill-through links. The Viewer.ActionEventArgs provides details about the action to be performed, including any necessary parameters or identifiers. Handlers for this event can perform custom processing, redirect actions, or cancel the default action execution by setting the Cancel property of the event arguments.
// Assuming 'viewer' is your Viewer control instance
viewer.Action += Viewer_CustomActionTriggered;;
// Handler for the CustomActionTriggered event
private void Viewer_CustomActionTriggered(object sender, ActionEventArgs e)
{
var viewer = (Viewer)sender;
// Check if there's a specific action defined
if (e.Action != null)
{
// Handle the custom action
HandleCustomAction(e.Action);
}
else if (e.PageNumber >= 0)
{
// Navigate to the specified page number if no specific action is defined
viewer.CurrentPage = e.PageNumber;
}
}
// Example method to handle a custom action
private void HandleCustomAction(IAction action)
{
// Implement custom action handling logic here
// This could involve checking the type of action and responding accordingly
Debug.WriteLine($"Handling custom action: {action.GetType().Name}");
}