GrapeCity ActiveReports Part 4: Uploading Reports to Silverlight Viewer
ActiveReports Script 4 – Uploading reports to Silverlight Viewer
This is the fourth in a series of ActiveReports Blogs and is a continuation of:
Part 1 Getting StartedPart 2 Run a reportPart 3 Silverlight Viewer Toolbar
1) To upload reports from your desktop and display them in the Silverlight viewer we will add a button to the webpage and some code behind. From the Toolbox, drag a Button control above the Viewer control in Design view of MainPage.xaml
2) The XAML Should look similar to this…
3) In the Properties window, rename the Button control to btnOpenReport and set the Content property to “Open Report”.
4) In the list of events, double-click the Click event.
5) On MainPage.xaml.cs that opens, add the following code to the btnOpenReport_Click event:
private void btnOpenReport_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog dialog = new OpenFileDialog();
//Show the dialog
bool? dialogResult = dialog.ShowDialog();
if (dialogResult != true) return;
using (Stream fs = (Stream)dialog.File.OpenRead())
{
viewer1.ViewModel.LoadDocument.Execute(fs);
}
}
6) Add using statement:
using System.IO;
7) Run, Click on Open Report, and point to the directory where your ActiveReports samples are installed:
C:\Users\...\Documents\GrapeCity\ActiveReports 6\Samples\CSharp\RDFViewer\RDFs
In Part 5 we will look at documentation tips.
Technorati Tags: ActiveReports,Getting started,grapecity,reporting components,DataDynamics,multi-part series,AR Tutorial,AR,AR Script,Tutorial,Script,part 4,license message,toolbar,uploading reports
tweetmeme_url = 'http://www.clubfarpoint.com/Forums/blogs/russells\_blog/archive/2012/01/09/grapecity-activereports-part-4-uploading-reports-to-silverlight-viewer.aspx'; tweetmeme_source = '@russcamtv'; tweetmeme_hashtags = '#appdev';