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

Silverlight Rendering

3 Answers 71 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
ankit
Top achievements
Rank 1
ankit asked on 06 Jun 2011, 08:14 PM
How can i render new report, on a click command. Like a refresh button.

Which function in the Silverlight ReportViewer can be used to request new report, I was not able to find any render Function.

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 07 Jun 2011, 08:21 AM
Hello ankit,

You can use the Report property of the Silverlight viewer to specify a new report i.e.:

private void button1_Click(object sender, RoutedEventArgs e)
        {
            this.ReportViewer1.Report = "Telerik.Reporting.Examples.CSharp.BarcodesReport, CSharp.ReportLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
        }

Kind regards,
Steve
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
ankit
Top achievements
Rank 1
answered on 14 Jun 2011, 08:38 PM
I have already assigned the ReportViewer.Report.

I just want it to reload or fetch the new data from the database..

Isn't re-fetch or reload command in the ReportViewer of silverlight
0
Steve
Telerik team
answered on 15 Jun 2011, 07:47 AM
Hello ankit,

Here is a sample snippet that illustrates how to invoke RefreshReport :
Copy Code
Copy Code
Copy Code
public partial class MainPage : UserControl
{
    public MainPage()
    {
        InitializeComponent();
    }
 
    void button1_Click(object sender, RoutedEventArgs e)
    {
        this.ReportViewer1.RefreshReport();
    }
}
 
static class ReportViewerExtensions
{
    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);
        }
    }
}


Kind regards,
Steve
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
ankit
Top achievements
Rank 1
Answers by
Steve
Telerik team
ankit
Top achievements
Rank 1
Share this question
or