When you use the WebViewer that is licensed with the Professional Edition, one of the ViewerTypes that you can select is FlashViewer. 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 following buttons are provided by default.
Heading | Page Range | |
Search | Zoom-out | Zoom |
Zoom-in | Single Page | Multiple pages |
Continuous Page | Previous Page | Next Page |
Page Number | Backwards | Forward |
Galley mode (only for RDL reports) |
Drop down the sections below for code samples.
To hide the toolbar
Visual Basic. NET code. Paste INSIDE the Page Load event |
Copy Code
|
---|---|
WebViewer1.FlashViewerToolBar.Visible = False |
C# code. Paste INSIDE the Page Load event |
Copy Code
|
---|---|
WebViewer1.FlashViewerToolBar.Visible = false; |
To add a using or Imports directive
To reduce the amount of code needed for the rest of the customizations, add a using or Imports directive at the top of the ASPX code view.
Visual Basic. NET code. Paste at the top of the ASPX code view |
Copy Code
|
---|---|
Imports GrapeCity.ActiveReports.Web.Controls |
C# code. Paste near the top of the ASPX code view |
Copy Code
|
---|---|
using GrapeCity.ActiveReports.Web.Controls; |
To reorder buttons in the toolbar
Visual Basic. NET code. Paste INSIDE the Page Load event |
Copy Code
|
---|---|
'Get a default tool from the toolbar. (You can also specify the tool index.) Dim tool As ToolBase = WebViewer1.FlashViewerToolBar.Tools("PageRangeButton") 'Remove the tool from the toolbar. WebViewer1.FlashViewerToolBar.Tools.Remove(tool) 'Insert the tool in a different position. WebViewer1.FlashViewerToolBar.Tools.Insert(0, tool) |
C# code. Paste INSIDE the Page Load event |
Copy Code
|
---|---|
//Get a default tool from the toolbar. (You can also specify the tool index.) ToolBase tool = WebViewer1.FlashViewerToolBar.Tools["PageRangeButton"]; //Remove the tool from the toolbar. WebViewer1.FlashViewerToolBar.Tools.Remove(tool); //Insert the tool in a different position. WebViewer1.FlashViewerToolBar.Tools.Insert(0, tool); |
To remove a button from the toolbar
Visual Basic. NET code. Paste INSIDE the Page Load event |
Copy Code
|
---|---|
'Get a default tool from the toolbar by name. (You can also specify the tool index.) Dim tool As ToolBase = WebViewer1.FlashViewerToolBar.Tools("PageRangeButton") ' Delete the tool from the toolbar. WebViewer1.FlashViewerToolBar.Tools.Remove(tool) |
C# code. Paste INSIDE the Page Load event |
Copy Code
|
---|---|
//Get a default tool from the toolbar by name. (You can also specify the tool index.) ToolBase tool = WebViewer1.FlashViewerToolBar.Tools["PageRangeButton"]; //Delete the tool from the toolbar. WebViewer1.FlashViewerToolBar.Tools.Remove(tool); |
To create a custom button and add it to the toolbar
Visual Basic. NET code. Paste INSIDE the Page Load event |
Copy Code
|
---|---|
Dim customButton As ToolButton = Tool.CreateButton("CustomButton") customButton.Caption = "Contanct Us" customButton.ToolTip = "ActiveReports Website" customButton.ClickNavigateTo = "http://activereports.grapecity.com/" 'Add a button at the specified index. 'An index value of 20 places it second to last, between the Forward and Backward buttons. 'Set the index value to 0 to place it in the first position at the left. WebViewer1.FlashViewerToolBar.Tools.Insert(20, customButton) |
C# code. Paste INSIDE the Page Load event |
Copy Code
|
---|---|
ToolButton customButton = Tool.CreateButton("CustomButton"); customButton.Caption = "Contact Us"; customButton.ToolTip = "ActiveReports Website"; customButton.ClickNavigateTo = "http://activereports.grapecity.com/"; //Add a button at the specified index. //An index value of 20 places it second to last, between the Forward and Backward buttons. //Set the index value to 0 to place it in the first position at the left. WebViewer1.FlashViewerToolBar.Tools.Insert(20, customButton); |
To create a custom toolbar and add it to the viewer
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 ToolsCollection = WebViewer1.FlashViewerToolBar.Tools 'Delete all of the buttons and separators from the toolbar. collection.Clear() 'Add pre-defined buttons. collection.Add(Tool.Create(ToolsCollection.ToolCommands.ZoomOutButton)) collection.Add(Tool.Create(ToolsCollection.ToolCommands.ZoomBox)) collection.Add(Tool.Create(ToolsCollection.ToolCommands.ZoomInButton)) ' Add a separator. collection.Add(Tool.CreateSeparator()) 'Add a pre-defined button. collection.Add(Tool.Create(ToolsCollection.ToolCommands.SearchButton)) 'Add a separator. collection.Add(Tool.CreateSeparator()) 'Add custom buttons. collection.Add(Tool.CreateButton("btn1")) collection.Add(Tool.CreateButton("btn2")) |
C# code. Paste INSIDE the Page Load event |
Copy Code
|
---|---|
//Get the collection of buttons and separators used in the toolbar. ToolsCollection collection = WebViewer1.FlashViewerToolBar.Tools; //Delete all of the buttons and separators from the toolbar. collection.Clear(); //Add pre-defined buttons. collection.Add(Tool.Create(ToolsCollection.ToolCommands.ZoomOutButton)); collection.Add(Tool.Create(ToolsCollection.ToolCommands.ZoomBox)); collection.Add(Tool.Create(ToolsCollection.ToolCommands.ZoomInButton)); //Add a separator. collection.Add(Tool.CreateSeparator()); //Add a pre-defined button. collection.Add(Tool.Create(ToolsCollection.ToolCommands.SearchButton)); //Add a separator. collection.Add(Tool.CreateSeparator()); //Add custom buttons. collection.Add(Tool.CreateButton("btn1")); collection.Add(Tool.CreateButton("btn2")); |