Microsoft sample report viewer application
If the Toolbox is not visible, you can access it from the View menu by selecting Toolbox. Locate the ReportViewer control in the Toolbox and drag it to the design surface below the ScriptManager control. After the control is added to the form the ReportViewer Tasks smart tag will appear prompting you to select a report.
The Report Server Url is the address to the report server and the Report Path is the full path to the report you want to render. If you want to view a report in local mode select either the Design a new report option to launch the report designer or select a report that is already part of the existing project. This property appears under the LocalReport node in the Properties pane.
You have the option of hiding one or more of the items on the ReportViewer toolbar when the report is rendered. For example, you can hide the print button.
To hide toolbar items, set the following ReportViewer properties to False in the Properties pane. The following example demonstrates how to render a report that has been deployed to a report server. Such as display statistics, page hits, server activity, referrals daily and hourly results. The report viewer control add alot to the visualization of your web servers' log analysis.
NET, Windows Forms,. NET, VB. NET, Microsoft. Visual Studio. Next, there is a window for selecting database objects that will be included in the data set Figure In our case, we need to select all elements of the query Query1 , which was generated by the tools of the Microsoft Access database.
This window displays the Query1 query fields that will be displayed in the report. Dataset Properties window with Query1 fields displayed. If desired, you can create one more or more data source using the New … button see figure After confirming to OK , the Report1. The window of Report1. To customize the name of each column, double-click in the corresponding cell in the Header area, as shown in Figure As you can see from the figure, the system has generated a table that contains 3 columns.
In our case, the query Query1 contains 6 columns. To add a column, you need:. Also, you can adjust the width of each column of the table. After setting all the headers, the window of the report file will have the form, as shown in Figure At this stage, you need to configure the data that will be displayed in the rows of the table.
The number of rows that will be displayed can be anything. The data is displayed in the Data area of the table. Each column of the table is individually configured. This column should be selected in the context menu of the table as shown in Figure Setting the data displaying in the column Book number. The corresponding Query1 query fields are selected in all subsequent columns. After the formation of all the columns, the table will has view as shown in Figure To set the report header, use the TextBox tool see Figure 25 , which you need to place above the table.
After placement, the corresponding object will be created. To specify a name, you need to click in the rectangular area of the TextBox tool. Therefore, in the program need to develop a new form. The development of an additional form is implemented in a standard way for MS Visual Studio. A more detailed example of creating a new form is described in the topic:. The window for specifying the template of the created form.
As a result, Microsoft Visual Studio will create a new form, which, so far, does not have any controls. Class, named Form2 corresponds to the form.
This control connects the application program with the report file Report1. Next, from the ToolBox toolbox on the Reporting tab, select the ReportViewer control and place it on the Form2 form with the mouse, as shown in Figure As a result, the system will automatically prompt you to select a report file in the ReportViewer Tasks window see Figure In addition, an instance object named reportViewer1 will be generated for the control.
After selecting the drop-down button, the Report Viewer Tasks window displays a list of the connected created report files. In our case, you need to select one file named TrainReports1. Here the prefix TrainReports1 stands for the name of our project. Connecting the project file to the ReportViewer control.
After selecting the Report1. The additional form window after you place and configure the ReportViewer control. These objects connect the application to the database. They can be used to programmatically manage the report.
But this is a completely different topic. To verify that the Report1. Checking the reportViewer1 connection with the Report1.
0コメント