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 russell.fustino@grapecity.com

 

ActiveReports Script 1 – Creating a Basic Silverlight Report

1. Create new Silverlight solution with web site in Visual Studio 2010 and accept the Defaults.

blog0

 

clip_image003

2. Add Viewer control to Mainpage.xaml

 

blog1

 

3. Set the Vertical Alignment and Horizontal Alignment properties to “Stretch”

blog2

4. Add a reference to the web project… for GrapeCity ActiveReports Web Component

blog8

5. Obtain your PublicKeyToken … go to c:/Windows/Assembly

blog9

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…)

<configuration>

<system.web>

<compilation debug="true" targetFramework="4.0" />

<httpHandlers>

<add path="*.rpx" verb="GET"

type="DataDynamics.ActiveReports.Web.Handlers.RpxHandler, ActiveReports.Web, Version=6.2.3164.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />

</httpHandlers>

</system.web>

</configuration>

7. Add a report to the web server project… by adding new item… ActiveReports 6 (xml-based) File

blog3

8. Add the appropriate report data source. Use the Build button to build the connection string.

blog4

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)

clip_image015

10. Enter this SQL Statement and you should see something similar to the following connection string:

Select * from Customers Order By Country

blog5

11. Right Click on the report designer and insert a Group Header

image

12. Right click and Select properties on Group Header

image

13. Set the DataField property to “Country” from properties drop down list for the Group Header

clip_image020

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)

clip_image021

15. Click Report Explorer.

clip_image022

blog6

16. Drag Country to Group header

17. Format font size country = bold and 18 point and

18. Drag CompanyName to Detail section slightly indented

blog7

19. Some cosmetics… make the GroupFooter height = 0

image

20. More cosmetics…  Delete PageHeader and PageFooter as they render blank space in the viewer. 

image

 

21. More cosmetics… Drag a cross section box control to give it a tabular look. 

image

 

22. Set the CanShrink to True on both the Detail and Group Header Properties

clip_image027

23. Select Preview tab to see report!

image

 

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.

tweetmeme_url = ‘http://www.clubfarpoint.com/Forums/blogs/russells_blog/archive/2012/01/04/grapecity-activereports-part-1-getting-started-with-silverlight-reporting.aspx’; tweetmeme_source = ‘@russcamtv’; tweetmeme_hashtags = ‘#appdev’;