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

RenderBegin killing DrillThrough parameters?

1 Answer 56 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 03 Feb 2012, 11:29 PM
I am hosting a Silverlight ReportViewer in a XAML file that programmatically sends parameters to the ReportViewer like this:
void TheReportViewer_RenderBegin(object sender, Telerik.ReportViewer.Silverlight.RenderBeginEventArgs args)
{
    args.ParameterValues["SubjectId"] = subjectId;
    runOnce = true;
}

I also have a DrillThrough action setup on the DetailsSecion of my initial report, which I created through the Design view, so that each details ReportItem has an action that operates like this (taken from the Designer.cs):
navigateToReportAction1.Parameters.Add(new Telerik.Reporting.Parameter("SubjectId", "=Fields.SubjectId"));
navigateToReportAction1.ReportDocumentType = "Application.Reports.ReportType.DetailReport, Application.Reports, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";

The DrillThrough is intended to load a DetailReport, passing the SubjectId of the particular item clicked in as a parameter. The navigateToReportAction behaves as expected, but my DetailReport loads with the following error.
One or more parameters are not set or have invalid values.

I believe the RenderBegin event might be blowing out my parameters, but even if I try some trickery like this:
private bool runOnce = false;
void TheReportViewer_RenderBegin(object sender, Telerik.ReportViewer.Silverlight.RenderBeginEventArgs args)
        {
            if (!runOnce)
            {
                args.ParameterValues["SubjectId"] = subjectId;
                runOnce = true;
            }
        }

my DetailReport still reaches the ItemDataBound event of the DetailSection with ReportParameters["SubjectId"].Value equaling null.

What am I to do? Has anyone run across a scenario where parameters passed from a DrillThrough don't load in the report navigated to?

Many thanks for your time,
-Jonathan

1 Answer, 1 is accepted

Sort by
0
Elian
Telerik team
answered on 07 Feb 2012, 06:03 PM
Hello Jonathan,

To see what values the parameters have, you should use the processing items:

//this will give you the default value you set at design time, not the actual value that is passed
ReportParameters["SubjectId"].Value
 
//To get the actual values you have to use the processing object
//this is an example showing how to do it in Report_ItemDataBinding event but you can as well do it in some other event
private void Report_ItemDataBinding(object sender, EventArgs e)
        {
            var report = (Telerik.Reporting.Processing.Report)sender;
            var paramValue = report.Parameters["ParamName"].Value;
        }      
You can hook to some event and debug to see where the problem comes from. Kind regards,
Elian
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
General Discussions
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Elian
Telerik team
Share this question
or