When you select the FlashViewer ViewerType of the WebViewer (Professional Edition license), the FlashViewer toolbar is very similar to the Viewer control's toolbar. You can show or hide it, reorder buttons, remove buttons, add custom buttons, or create a custom toolbar. Use the Web.Controls namespace to create custom buttons or a custom toolbar that you can specify in the WebViewer's FlashViewerToolbar property.
The buttons that are available in the toolbar by default are:
To hide the toolbar
![]() |
Note: If the ViewerType property of your WebViewer control is not set to FlashViewer, this code is ignored. |
- In the Visual Studio Solution Explorer, right-click the ASPX file that contains your WebViewer and select View Designer.
- In the design view of your web form, double-click the WebViewer. This creates an event handling method for the Page Load event and takes you to the code view of the page.
- Use code like the following to hide the toolbar:
To write the code in Visual Basic.NET Visual Basic.NET code. Paste INSIDE the Page Load event.
Copy CodeWebViewer.FlashViewerToolBar.Visible = False C# code. Paste INSIDE the Page Load event.
Copy CodeWebViewer1.FlashViewerToolBar.Visible = false;
To rearrange buttons in the toolbar
- In the Visual Studio Solution Explorer, right-click the ASPX file that contains your WebViewer and select View Designer.
- In the design view of your web form, double-click the page. This creates an event handling method for the Page Load event and takes you to the code view of the page.
- Use code like the following to create a button and insert it at the beginning of the toolbar:
To write the code in Visual Basic.NET Visual Basic.NET code. Paste INSIDE the Page Load event.
Copy Code'Get an existing tool from the toolbar. (If you prefer, you can specify the index of the tool.) Dim tool As DataDynamics.ActiveReports.Web.Controls.ToolBase = WebViewer1.FlashViewerToolBar.Tools("PageRangeButton") 'Remove the tool from the toolbar. WebViewer1.FlashViewerToolBar.Tools.Remove(tool) 'Add the tool in a different position. WebViewer1.FlashViewerToolBar.Tools.Insert(0, tool)C# code. Paste INSIDE the Page Load event.
Copy Code//Get an existing tool from the toolbar. (If you prefer, you can specify the index of the tool.) ToolBase tool = WebViewer1.FlashViewerToolBar.Tools[ToolsCollection.ToolCommands.PageRangeButton]; //Remove the tool from the toolbar. WebViewer1.FlashViewerToolBar.Tools.Remove(tool); //Add the tool in a different position. WebViewer1.FlashViewerToolBar.Tools.Insert(8, tool);
To remove a button from the toolbar
- In the Visual Studio Solution Explorer, right-click the ASPX file that contains your WebViewer and select View Designer.
- In the design view of your web form, double-click the WebViewer. This creates an event handling method for the Page Load event and takes you to the code view of the page.
- Use code like the following to remove a button from the toolbar:
To write the code in Visual Basic.NET Visual Basic.NET code. Paste INSIDE the Page Load event.
Copy Code'Get an existing tool from the toolbar. (If you prefer, you can specify the index of the tool.) Dim tool As DataDynamics.ActiveReports.Web.Controls.ToolBase = WebViewer1.FlashViewerToolBar.Tools("PageRangeButton") 'Remove the tool from the toolbar. WebViewer1.FlashViewerToolBar.Tools.Remove(tool)C# code. Paste INSIDE the Page Load event.
Copy Code//Get an existing tool from the toolbar. (If you prefer, you can specify the index of the tool.) ToolBase tool = WebViewer1.FlashViewerToolBar.Tools[ToolsCollection.ToolCommands.PageRangeButton]; //Remove the tool from the toolbar. WebViewer1.FlashViewerToolBar.Tools.Remove(tool);
To create a custom button and add it to the toolbar
![]() |
Tip: The ToolsCollection class in the Web.Controls namespace has the standard System.Collections.ObjectModel.Collection methods available, so if you want to just add the button to the end of the toolbar, you can use the Add method instead. |
- In the Visual Studio Solution Explorer, right-click the ASPX file that contains your WebViewer and select View Designer.
- In the design view of your web form, double-click the WebViewer. This creates an event handling method for the Page Load event and takes you to the code view of the page.
- Use code like the following to create a button and insert it at the beginning of the toolbar:
To write the code in Visual Basic.NET Visual Basic.NET code. Paste INSIDE the Page Load event.
Copy CodeDim customButton As ToolButton = Tool.CreateButton("CustomButton") customButton.Caption = "Visit Us!" customButton.ToolTip = "Click here to visit datadynamics.com" customButton.ClickNavigateTo = "http://www.datadynamics.com" 'Insert the button at the specified index, in this case 20 'to put it in the second-to-last place, between Backward and Forward. 'Set the index parameter to 0 to put it in the left-most position. WebViewer.FlashViewerToolBar.Tools.Insert(20, customButton)C# code. Paste INSIDE the Page Load event.
Copy CodeToolButton customButton = Tool.CreateButton("CustomButton"); customButton.Caption = "Visit Us!"; customButton.ToolTip = "Click here to visit datadynamics.com"; customButton.ClickNavigateTo = "http://www.datadynamics.com"; //Insert the button at the specified index, in this case, 20 //to put it in the second-to-last place, between Backward and Forward. //Set the index parameter to 0 to put it in the left-most position. WebViewer.FlashViewerToolBar.Tools.Insert(20, customButton);
To create a custom toolbar and add it to the viewer
- In the Visual Studio Solution Explorer, right-click the ASPX file that contains your WebViewer and select View Designer.
- In the design view of your web form, double-click the WebViewer. This creates an event handling method for the Page Load event and takes you to the code view of the page.
- Use code like the following to create a custom toolbar and add it to the viewer:
To write the code in Visual Basic.NET Visual Basic.NET code. Paste INSIDE the Page Load event.
Copy Code'Get the collection of buttons and separators used in the toolbar Dim collection As DataDynamics.ActiveReports.Web.Controls.ToolsCollection = WebViewer1.FlashViewerToolBar.Tools 'Remove all buttons and separators collection.Clear() 'Add pre-defined buttons collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.Create(DataDynamics.ActiveReports.Web.Controls.ToolsCollection.ToolCommands.ZoomOutButton)) collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.Create(DataDynamics.ActiveReports.Web.Controls.ToolsCollection.ToolCommands.ZoomBox)) collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.Create(DataDynamics.ActiveReports.Web.Controls.ToolsCollection.ToolCommands.ZoomInButton)) 'Add separator collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.CreateSeparator()) 'Add pre-defined button collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.Create(DataDynamics.ActiveReports.Web.Controls.ToolsCollection.ToolCommands.SearchButton)) 'Add separator collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.CreateSeparator()) 'Add custom buttons collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.CreateButton("btn1")) collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.CreateButton("btn2"))C# code. Paste INSIDE the Page Load event.
Copy Code//Get the collection of buttons and separators used in the toolbar DataDynamics.ActiveReports.Web.Controls.ToolsCollection collection = WebViewer1.FlashViewerToolBar.Tools; //Remove all buttons and separators collection.Clear(); //Add pre-defined buttons collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.Create(DataDynamics.ActiveReports.Web.Controls.ToolsCollection.ToolCommands.ZoomOutButton)); collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.Create(DataDynamics.ActiveReports.Web.Controls.ToolsCollection.ToolCommands.ZoomBox)); collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.Create(DataDynamics.ActiveReports.Web.Controls.ToolsCollection.ToolCommands.ZoomInButton)); //Add separator collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.CreateSeparator()); //Add pre-defined button collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.Create(DataDynamics.ActiveReports.Web.Controls.ToolsCollection.ToolCommands.SearchButton)); //Add separator collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.CreateSeparator()); //Add custom buttons collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.CreateButton("btn1")); collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.CreateButton("btn2"));
In the Class Library portion of the documentation, you can see all of the available properties and methods in the Web assembly's Controls namespace.
Getting Started
Flash Viewer Options
Walkthroughs
Flash Viewer
Customizing the Flash Viewer UI
Hide All
