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:
Note: If the ViewerType property of your WebViewer control is not set to FlashViewer, this code is ignored. |
To write the code in Visual Basic.NET
Visual Basic.NET code. Paste INSIDE the Page Load event. |
Copy Code |
---|---|
WebViewer.FlashViewerToolBar.Visible = False |
To write the code in C#
C# code. Paste INSIDE the Page Load event. |
Copy Code |
---|---|
WebViewer1.FlashViewerToolBar.Visible = false; |
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) |
To write the code in C#
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 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) |
To write the code in C#
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); |
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. |
To write the code in Visual Basic.NET
Visual Basic.NET code. Paste INSIDE the Page Load event. |
Copy Code |
---|---|
Dim 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) |
To write the code in C#
C# code. Paste INSIDE the Page Load event. |
Copy Code |
---|---|
ToolButton 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 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")) |
To write the code in C#
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.