This is a migrated thread and some comments may be shown as answers.

Light switch refresh report issue

1 Answer 21 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Efrael
Top achievements
Rank 1
Efrael asked on 31 Jan 2013, 11:59 AM
Hi,
I'm using a reportviewer inside a silverlight custom control.
This custom control is embedded into a lightswitch project.

In the LS screen the first column on the left contains a grid with the records I'd like to print, the second column (right) contains the custom control where the reportviewer is shown.

Everything works fine, except that when I change the record on the left column's grid, I have to manually refresh the reportviewer, using its refresh button.
I can't find a way to programmatically add a refresh method triggered to the grid_SelectionChanged event.
 
What I'm looking for is an easy way to refresh the reportviewer as I do with its button.

Any help?

Thx

1 Answer, 1 is accepted

Sort by
0
Hadib Ahmabi
Top achievements
Rank 1
answered on 01 Feb 2013, 01:02 PM
You can change the report property, this should cause a refresh:

            var rep = this.ReportViewer1.Report;
            this.ReportViewer1.Report = "";
            this.ReportViewer1.Report = rep;

There's also this:


        public static void RefreshReport(this ReportViewer reportViewer)
        {
            var layoutRoot = (FrameworkElement)VisualTreeHelper.GetChild(reportViewer, 0);
            var viewerModel = (ReportViewerModel)layoutRoot.DataContext;
            var refreshCommand = viewerModel.RefreshReportCommand;
            if (refreshCommand.CanExecute(null))
            {
                refreshCommand.Execute(null);
            }
        }
Tags
General Discussions
Asked by
Efrael
Top achievements
Rank 1
Answers by
Hadib Ahmabi
Top achievements
Rank 1
Share this question
or