.Net Framework Used: .Net 2.0
Other Components: Web Client Software Factory (WCSF), Repository Factory
How to create a ReportViewer using Local Mode?
1.) Create a report template file (.RDLC) in your website.
2.) Design your report template file by double click the
test.rdlc
3.) In your report template, you may need to create the dataset so that it can be assigned to your report. To create a dataset, you need to create your store procedure first.
3.) In your aspx page (switch to design mode), drag and drop the ReportViewer control to your page.
4.) Create your datasource and bind to the reportviewer. In my example, It's using ObjectContainerDataSource. Do it in design mode, it will save a lot of times. Moreover, multiple datasources are possible.
1. Create a report template file (.RDLC)Steps:-
1.)To Create a report template, open Solution Explorer and create a new folder under Development Website. Name the folder "Reports".
2.) Right Click on the
Reports folder and click on
Add New Item.
3.) In the Template window, select
Report and click
Add.
4.) you will notice a file named SampleReport.rdlc created under the Report folder.
2. Design your report template file & 3. Create DataSet and Assign it to your report template.Steps:-
1.) Double click on SampleReport.rdlc to open the designer.
2.) In the designer, there is a toolbox on your left side. Open the ToolBox and drag the item you want into the report. For instance, drag a Table.
3.) Notice that there is a datasource window under the toolbox. That's the place where you create your dataset.
4.) Create your dataset by specifying your connection, Store Procedure and etc.
5.) After you have created your dataset, it will appear on your left panel in Website Data Source window.
6.) Expand it and drag the file to the place you want to place it on the report designer. For example, drag and place it in the Table object.
7.) After you have assigned the attribute, the report template creation is done.
4. Add ReportViewer control into your ASPX pageSteps:-
1.) Create an ASPX page if you do not have one.
2.) Open your Toolbox and drag the ReportViewer control to your ASPX page (Design mode).
3.) Once you have created the control on your aspx page, select it and click on the arrow on the top right corner to setup the control. For example, Bind it to your RDLC file.
4.) After you have selected a RDLC file, drag and drop an ObjectContainerDataSource control to your page. ObjectContainerDataSource requires the
Microsoft.Practices.Web.UI.WebControls.dll to be added to the toolbox.
5.) Configure the ObjectContainerDataSource. For e.g Name and BusinessEntities. If you are using WCSF and Repository Factory to create your web pages, Business Entities has been created based on your Database.
6.) Now, Choose the Datasource for ReportViewer control and Match it to the right dataset.
7.) You have done the setup for your report viewer control, and Now, the final step is to provide the data to your DataSource in your code behind.
You may also refer to
This Website as reference.