Friday, April 10, 2009

Report Viewer for Silverlight 2

Silverlight platform has aroused interest in developing Line of Business Apps for a lot of people. But Microsoft has not given any Reporting control features with its release of silverlight. This is sort of a difficult balance that developers have to take in terms of giving a rich UI with support for .net programming.

Neither any popular Microsoft Platform Controls vendors have come up with any innovative ideas. Perpetuum soft has a solution, but I am not convinced at the solution as it asks for us to write code and create a dataset for displaying reports. For me ideally the reporting platform should take care of all the data plumbing, formatting, paging, printing etc., Also I wanted to use Microsoft SQL Server reports in Remote mode to be shown in the silverlight platform.

Currently as I see there is only one way of doing these reports. Create your reports definition files in Sql 2005 or 2008 and then use an aspx page to load them. A short reference for the code snippet. It is better to place this in the page_load event of the aspx page.

And currently there are 2 ways to display the aspx pages (which host the Report viewer control) in silverlight.

1. Use the div parameter in combination with javascript to display the control.


ReportParameter[] parm = new ReportParameter[1];
parm[0] = new ReportParameter("id",1);
ReportViewer1.ShowCredentialPrompts = false;
ReportViewer1.ServerReport.ReportServerUrl = "Replace with Report Server Url";
ReportViewer1.ServerReport.ReportPath = "Replace with Report Path Name";
ReportViewer1.ServerReport.SetParameters(parm);
ReportViewer1.ServerReport.Refresh();


This can use a Html Host control like Html Host Using IFrame or the c1HtmlHost provided by ComponentOne as well.

This solution now can support all features needed for a reporting platform. But obviously using windowless property to show the Html in the browser leaves the browser to manage your silverlight app and has an impact on performance.

2. And the second option is write your own reporting solution. I am not good at it yet :).

Please contact me if you have better ideas of doing a solution for reporting in silverlight. Will be glad to hear those.

No comments: