Document Library for WPF | ComponentOne
SSRSDocumentSource for WPF / Quick Start
In This Topic
    Quick Start
    In This Topic

    This quick start topic guides you through a step-by-step process of creating a simple application for loading a SSRS report in the FlexViewer control. It uses a SSRS report named AdventureWorks, from the ComponentOne report server.

    The following image shows a SSRS report opened in FlexViewer.

    To load a SSRS report in FlexViewer programmatically

    Step 1: Setting up the application

    1. Create a new WPF application.
    2. Drag and drop C1FlexViewer control in the XAML view.
    3. Add Loaded="Window_Loaded" to the <Window> tag in XAML view to create the Windows_Loaded event.

    Step 2: Load the SSRS report in FlexViewer

    1. Switch to the code view and add the following code to initialize the variables to be used as parameters for NetWorkCredential Property.
      Shared ReadOnly
      ssrsUrl As String = "http:// server url",
      ssrsUserName As String = "*",
      ssrsPassword As String = "*", 
      ssrsDomain As String = String.Empty
      
      static readonly string
      ssrsUrl = "http:// server url",
      ssrsUserName = "*",
      ssrsPassword = "*",
      ssrsDomain = string.Empty;
      
    2. Add the following code in the Windows_Loaded event to provide the location of the report on the server using DocumentLocation and set the credentials using Credential property:
      Dim ssrsDocSource As New C1SSRSDocumentSource()
      ssrsDocSource.DocumentLocation = New SSRSReportLocation(ssrsUrl,
                                       "AdventureWorks/Sales Order Detail")
      ssrsDocSource.Credential = New NetworkCredential(ssrsUserName,
                                 ssrsPassword, ssrsDomain)
      
      C1SSRSDocumentSource ssrsDocSource = new C1SSRSDocumentSource();
      ssrsDocSource.DocumentLocation = new SSRSReportLocation(ssrsUrl, 
                                       "AdventureWorks/Sales Order Detail");
      ssrsDocSource.Credential = new NetworkCredential(ssrsUserName, 
                                 ssrsPassword, ssrsDomain);
      
    3. Render the SSRS report in the FlexViewer control using DocumentSource property.
      viewer.DocumentSource = ssrsDocSource
      
      viewer.DocumentSource = ssrsDocSource;
      

    Step 3: Build and run the project

    1. Press Ctrl+Shift+B to build the project.
    2. Press F5 to run the application.
    See Also