[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

WPF ReportViewer user control

Posted on 2011-09-06
13
Medium Priority
?
1,289 Views
Last Modified: 2012-05-12
I have a windows application that uses WPF, and currently it displays reports using SSRS. When a user clicks on a report link, it opens the report in a new IE window. What I would like it to do is when the user clicks on a report link, have it display the report within the windows application itself. I want to leverage the ReportViewer, by creating a user control, so that I can implement the control on any page I want within my application. How would I do this? Attached is the user control that I have created, but I am not sure where to go from here.
<UserControl x:Class="HCB.VS2010.ABISS3.UI.FormsAndControls.UserControls.ReportViewer"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
            
    </Grid>
</UserControl>

Open in new window

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace HCB.VS2010.ABISS3.UI.FormsAndControls.UserControls
{
    /// <summary>
    /// Interaction logic for ReportViewer.xaml
    /// </summary>
    public partial class ReportViewer : UserControl
    {
        public ReportViewer()
        {
            InitializeComponent();
        }
    }
}

Open in new window

0
Comment
Question by:jjliu4492
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
13 Comments
 
LVL 7

Expert Comment

by:Gewgala
ID: 36491414
Question: Is your report viewer an actual web page?  The part with the links that the user clicks?

Depending on the answer to my question above you may be able to leverage a WebBrowser control within your WPF application if the ReportViewer forces the results to be displayed within a browser.  

You would need to post a little more information about your report viewer and also, this is a WPF Desktop application right?  Not xbap?
0
 

Author Comment

by:jjliu4492
ID: 36495828
Yes this is a WPF Desktop application.

I would like my report viewer to be a user control within the page that has the report link that the user clicks. So for example, when the user clicks on the Inventory Report link, the report viewer control will be populated within that same page.
0
 
LVL 7

Expert Comment

by:Gewgala
ID: 36496958
Ok and your report viewer, under normal circumstances that is embedded into a web page right?
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

Author Comment

by:jjliu4492
ID: 36497405
Yes, how it works now is when a report link is clicked, the report opens in a new IE web page window.
0
 
LVL 7

Expert Comment

by:Gewgala
ID: 36497493
Ok, now where the report links are, is that also in a web page?  What generates the links to click?
0
 

Author Comment

by:jjliu4492
ID: 36497863
The links are buttons on the top of the page on the windows application. Please see screenshot attachments. The attachment called DesktopApplication is the application where the report links are located, they are located on the top right of the screen. When you click the "Inventory Details" link, the report opens in a new IE window.  desktop applicationReportWindow.png
0
 
LVL 7

Expert Comment

by:Gewgala
ID: 36499207
Ok.  What is the code that is executed when you click on one of those links?

Because, it seems like what is happening is when clicking the link it's trying to navigate to a specific URL.  If you know what that URL is, you could add a WebBrowser control to your WPF window, and then do something like this:

webBrowser1.NavigateToUrl("theUrlTheReportViewerIsTryingToLoad");

have you tried that?
0
 

Author Comment

by:jjliu4492
ID: 36499322
Will the NavigateToURL open the report in the existing window, or in a new window?
0
 
LVL 7

Expert Comment

by:Gewgala
ID: 36499344
It will open it in the WebBrowser control that is in your WPF Form.  You can drag it from the toolkit onto your window in the Visual Studio Designer.
0
 

Author Comment

by:jjliu4492
ID: 36503281
error message: "System.Windows.Controls.WebBrowser does not contain a definition for 'NavigateToURL'..."
0
 
LVL 7

Accepted Solution

by:
Gewgala earned 2000 total points
ID: 36503303
Sorry, I got the method confused between the WPF WebBrowser and the WinForm WebBrowser.  You just want the "Navigate" method.

So:  

webBrowser1.Navigate("http://some address/page");

Where webBrowser1 is the name of the control on your wpf window
0
 

Author Comment

by:jjliu4492
ID: 36503345
It's working, thanks a ton!
0
 
LVL 7

Expert Comment

by:Gewgala
ID: 36503434
Glad I could help :)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question