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

Parameters Null on Subreport

5 Answers 189 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jose Granja
Top achievements
Rank 1
Jose Granja asked on 01 Sep 2010, 05:41 PM
Hi,

i've created a subreport with parameters and when the master report passes them to the subreport they are all null. Even I created a parameter: integer Test and when I pass the value to the subreport (it's hardcore and not get from the master params) it is null. I don't now what to do. Were can be the problems??? All the params are passed with null :(

thanks in advance

regards,
jose

5 Answers, 1 is accepted

Sort by
0
Jose Granja
Top achievements
Rank 1
answered on 01 Sep 2010, 05:52 PM
I get the parameters with this code:

ReportParameters["SubStartDate"].Value

on this event:

this.ItemDataBinding += new EventHandler(Report_ItemDataBinding);

my datasource is set programatelly on the same event

hope that extra info helps a little bit
0
Steve
Telerik team
answered on 02 Sep 2010, 05:06 PM
Hello Jose,

ItemDataBinding event is a bit too early and the parameter values are not available yet. You should use ItemDataBound or NeedDataSource for such scenarios.

Greetings,
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
Jose Granja
Top achievements
Rank 1
answered on 02 Sep 2010, 05:23 PM
I'm afraid it doesn't work. I tried in the event ItemDataBound  and NeedDataSource  and both parameters are null.

If I try mi subreport with the preview the parameters are populated allright! It's when the report is acting as a subreport that I get always null from the parameters! I check those parameters to be populated and even initialised them with mocking values just to try which part of the engine was not working!

it seems there's a problem (i'm forgetting to do something) somewhere! But I followed the documentation 20 times and plus the proces is not complicated at all.

Do you have anymore ideas?

thanks and regards,

jose
0
Accepted
Steve
Telerik team
answered on 03 Sep 2010, 05:15 PM
Hi Jose Granja,

Not sure what documentation you're referring to. In the Using Report Parameters programmatically help article, we show that you should be using the processing counterpart of the report to access the parameters i.e.:

private void Report1_NeedDataSource(object sender, System.EventArgs e)
{
    //Take the Telerik.Reporting.Processing.Report instance
    Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender;

    // Transfer the value of the processing instance of ReportParameter
    // to the parameter value of the sqlDataSource component
    this.sqlDataSource1.Parameters[0].Value = report.Parameters["SubStartDate"].Value;

    // Set the SqlDataSource component as it's DataSource
    report.DataSource = this.sqlDataSource1;
}

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
Jose Granja
Top achievements
Rank 1
answered on 03 Sep 2010, 05:24 PM
Awesome! Thank you very much!

regards,

jose
Tags
General Discussions
Asked by
Jose Granja
Top achievements
Rank 1
Answers by
Jose Granja
Top achievements
Rank 1
Steve
Telerik team
Share this question
or