Welcome to my new multi-part blog series on ActiveReports. In this part, we will look at creating a Basic Silverlight Report from scratch using ActiveReports Professional Edition. In subsequent parts, we will look at running reports from a web server, opening a report file from the desktop to display in Silverlight Viewer in browser, PDF Printing, Localization, Documentation tips, Silverlight Viewer customization, Out-of-Browser support and much more. So stay tuned and I hope you enjoy this series. Feel free to send feedback to firstname.lastname@example.org
ActiveReports Script 1 – Creating a Basic Silverlight Report
1. Create new Silverlight solution with web site in Visual Studio 2010 and accept the Defaults.
2. Add Viewer control to Mainpage.xaml
3. Set the Vertical Alignment and Horizontal Alignment properties to “Stretch”
4. Add a reference to the web project… for GrapeCity ActiveReports Web Component
5. Obtain your PublicKeyToken … go to c:/Windows/Assembly
6. Edit web.config and add http handlers for the rpx files in <System.Web> section. This is for running the localhost web server. (If you have the handlers defined in IIS, you do not need to do this…)
<compilation debug="true" targetFramework="4.0" />
<add path="*.rpx" verb="GET"
type="DataDynamics.ActiveReports.Web.Handlers.RpxHandler, ActiveReports.Web, Version=6.2.3164.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
7. Add a report to the web server project… by adding new item… ActiveReports 6 (xml-based) File
8. Add the appropriate report data source. Use the Build button to build the connection string.
9. In my case, I am using SQL Server 2008 R2, so I press the build button and select SQL Server Client 10.0. Add the Northwind db (to install Northwind DB Click Here)
10. Enter this SQL Statement and you should see something similar to the following connection string:
Select * from Customers Order By Country
11. Right Click on the report designer and insert a Group Header
12. Right click and Select properties on Group Header
13. Set the DataField property to “Country” from properties drop down list for the Group Header
14. If you do not see the Report Explorer on the toolbar, Right click on Visual Studio toolbar, select customize and check off ActiveReports6 and this will add the Report Explorer to the toolbar ( Otherwise … View -> Other Windows -> Report Explorer)
15. Click Report Explorer.
16. Drag Country to Group header
17. Format font size country = bold and 18 point and
18. Drag CompanyName to Detail section slightly indented
19. Some cosmetics… make the GroupFooter height = 0
20. More cosmetics… Delete PageHeader and PageFooter as they render blank space in the viewer.
21. More cosmetics… Drag a cross section box control to give it a tabular look.
22. Set the CanShrink to True on both the Detail and Group Header Properties
23. Select Preview tab to see report!
Yeah! In Part 2 we will cover how to run this report on a web server, using a little code behind on the Silverlight Viewer that we added in this Step 2 above.