This time I'd like to talk about how to successfully integrate Telerik Reporting features to your Silverlight Solution. However I'd like get into more detail and give you the real thing, not only the nice picture as shown in Telerik site.
What I'd like to cover here is not only integrate the Reporting but also how successfully configure the whole thing and have it ready to deploy to your Preview / Production server.
Let's start... you will need three projects in your solution. One is the Silverlight project, another is the ASP.Net project that will be hosting the whole thing and finally a Library Application project for your reports.
I will assume you have already added a new report to your Report library and you followed the wizard and had your report filled with some data.
In your Silverlight project you will need to add a new page to show your report and to do so, you'll need to add a RadHtmlPlaceHolder Control (also from Telerik) and set the SourceUrl attribute to something like this:
<telerik:RadHtmlPlaceHolder SourceUrl="MySalesReport.aspx"> </telerik:RadHtmlPlaceHolder>
Add a new WebForm control to your ASP.NET project and named as "MySalesReport.aspx". Add a ReportViewer Control and add your report by populating the Report property in the Properties Panel (be sure to add a reference to your Report library project first). That's it!
That's it? What are you talking about? Here comes the tricky stuff...
Notice in the video that you need to add style properties for your form, body and html elements. But you also need to be sure your div tag has also width = 100%. If you don't do it, your report won't be 100% width in some browser like IE 8.
If you deploy the project as it is right now you'll notice you won't get any data. In order to fix this, first be sure to set "Copy Local" property equals true for your Telerik.Reporting.dll and Telerik.ReportViewer.WebForms.dll
If you used the report wizard that means your connection string is contained within your DataSetTableAdapter. One solution for this problem is to overwrite your connection string with the one specified in your web.config (in your ASP.NET project).
How to do that? You'll first need to add this to your Constructor after the InitializeComponents calling:
this.DataSource = null;Then add a new handler for the event NeedDataSource. Here you will need to get your connection string and set it to your DataSetTableAdapter and then have it fill your DataSetTable and set this object as your report data source:
ConnectionStringSettings connSettings = ConfigurationManager.ConnectionStrings["SampleDB"];if ((connSettings != null) && (connSettings.ConnectionString != null)) {this.myDataSetTableAdapter1.Connection.ConnectionString = connSettings.ConnectionString;}this.myDataSetTableAdapter1.Fill(this.myDataSet.MyDataSetTable);this.DataSource = this.myDataSet.MyDataSetTable;One more thing, you'll notice that you can´t access to your DataSetTableAdapter's ConnectionString property to change it.
This is because this property is a private property. However your DataSetTableAdapter class definition is partial. That means you can add modify this class, so add a new partial class for you Adapter after your Report class definition and add a new property to get access to your ConnectionString.
Now, that's really it. You are good to go.
