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

Retrieving Parameter Values passed from SilverLight ReportViewer

3 Answers 144 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
RAVINDRA
Top achievements
Rank 1
RAVINDRA asked on 27 Jun 2011, 07:39 PM
Hi

I want to send some parameters from SL ReportViewer and want to access them in the Report Code behind. Please let me does it support to access the parameters from report code behind.

I have written teh follwoing in xaml code behibd.

private void RepViewer_RenderBegin(object sender, Telerik.ReportViewer.Silverlight.RenderBeginEventArgs args)
        {
            args.ParameterValues["key1"] = 3;
        }

And in the report i tried to acces in the following way.

public Report1()
        {
            InitializeComponent();
            var abc = this.ReportParameters[0].Value;
        }

But its showing the value of abc as null.

Please let me know whether its possible to use value in the code.

Thanks in advance
Ravindra

3 Answers, 1 is accepted

Sort by
0
Accepted
Steve
Telerik team
answered on 28 Jun 2011, 07:36 AM
Hi RAVINDRA,

That is expected because the report parameters have not yet been initialized in the report constructor. You should access them in the NeedDataSource event as shown in the Using Report Parameters programmatically help article.

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
Gerrie
Top achievements
Rank 1
answered on 04 Aug 2011, 04:35 PM
Hi, I am trying to do exactly that, but the program never enters my "NeedDataSource" event

I am using a entitydatasource

this is my code:

public partial class ReportTimer : Telerik.Reporting.Report
{
public ReportTimer()
{
//
// Required for telerik Reporting designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
            this.entityDataSourceReportTimer = null;
            this.DataSource = null;
            this.crosstab1.DataSource = null;
  }


  private void ReportTimer_NeedDataSource(object sender, EventArgs e)
  {
    this.ReportParameters[0].Value = "testing"
  }
}

Please Help!

regards
0
Steve
Telerik team
answered on 05 Aug 2011, 01:50 PM
Hello Gerrie,

The event is fired whenever the report does not have data source set. Clearly you're setting it to null in the report constructor so it should be fired, as your report does not have data source. Additionally as referenced in the link from previous post, you should use the processing counterpart and not the definition report parameters i.e.:

Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender;
report.Parameters["Parameter1"].Value = "testing";


All the best,
Steve
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Tags
General Discussions
Asked by
RAVINDRA
Top achievements
Rank 1
Answers by
Steve
Telerik team
Gerrie
Top achievements
Rank 1
Share this question
or