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

Visible Report Parameter Problem

10 Answers 370 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Lior ef
Top achievements
Rank 1
Lior ef asked on 15 Jul 2010, 03:17 PM
Hi,

i have a report parameter defined (Screenshot#1)
i want to set a Visible property of a subreport to whatever the user input at the visible report parameter.

i use the following code at the Master Report:
private void subReport1_ItemDataBound(object sender, EventArgs e)
{
            (sender as Telerik.Reporting.Processing.SubReport).Visible = (bool)this.ReportParameters["ShowField"].Value;
}

no matter what i do the Value of the parameter is always True, even if i don't give the parameter a value when i define it.
doesn't matter if i check or uncheck the checkbox of the parameter shown of the screen.

please can someone help me?

thanks.

10 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 16 Jul 2010, 04:28 PM
Hello Lior ef,

We are unable to reproduce the issue you have experienced with the provided code snippet. You have mentioned a checkbox parameter when the default UI for Boolean Report Parameter is a two radio buttons. If you are using a custom UI then you will need a custom Preview button. 

To avoid any confusion please check out the attached sample project, we would appreciate if you modify the attached project to reflect the problem or if it is showing what you think is wrong - please elaborate.

Best wishes,
Peter
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
Lior ef
Top achievements
Rank 1
answered on 18 Jul 2010, 06:21 AM
hi peter,

as shown in the screenshot - the parameter is a boolean type parameter that i set its' Visible property to True,
what i get in the ReportViewer is a Checkbox that represents the parameter, not a radio button.
i'm using the latest version of Reporting and Rad Controls.

i should have mentioned i work in WPF on visual studio 2008, so i really don't know what to do with the silverlight project you uploaded.
plus, when i try the open your project i get an error message (shown in the screenshot i've attached).

so if you be so kind as to upload a new WPF project, it will be great - thanks.
0
Accepted
Peter
Telerik team
answered on 20 Jul 2010, 06:55 AM
Hello Lior ef,

Unfortunately we are able to reproduce the issue related to the WPF Report Viewer that a single value boolean parameters is returning an incorrect value. We have logged it in our bug tracking system and we will introduce a fix with a subsequent internal build or service pack. In the meantime as a workaround our suggestion would be to use a Custom UI for the Parameters  as shown in the attached WPF project.

Your Telerik points have been updated as a token of gratitude for bringing the first problem to our attention. Please excuse us for the temporary inconvenience.

Best wishes,
Peter
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
Lior ef
Top achievements
Rank 1
answered on 26 Jul 2010, 06:53 AM
hi peter,

i'm sorry but i can't seem to open the project you uploaded, as i mentioned i'm using visual studio 2008, could it be that this project
is ment for VS2010?
can you please upload the project again?

thanks so much.
0
Peter
Telerik team
answered on 29 Jul 2010, 09:10 AM
Hello Lior ef,

I have attached a Visual Studio 2008 solution of the sample project.

Best wishes,
Peter
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
Kobus
Top achievements
Rank 1
answered on 29 Jul 2010, 12:25 PM
Hi,

I currently have the same problem in the Silverlight Report Viewer 2010 Q2 (VS2010).

From the WPF sample attached It seems that the reporting parameters control is hidden and "manual" report parameters are used, correct?
this implies that all the parameters would have to be coded for each of the reports that uses a boolean value as a parameter.

Could you please post a sample workaround for silverlight if this is not the case.

Regards,
K
0
Peter
Telerik team
answered on 30 Jul 2010, 05:10 PM
Hello Kobus,

This issue has been fixed. You can find the fix in the Latest Internal Build, which you can download from your Telerik Account.

Kind regards,
Peter
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
Wadigzon
Top achievements
Rank 1
answered on 11 Feb 2013, 09:46 PM
Hi there, 
I seem to have the same problem, I am using the latest telerik report Q3 2012

I am just following the sample shown in the video "Reporting - SubReports" as shown here:
http://www.telerik.com/support/trainer/reporting.aspx

I am using Visual Studio 2010, the video is using Visual Basic, I am using C# and
this is the code I have almost at the last part of the video:
private void subReport1_ItemDataBound(object sender, EventArgs e)
{
    Telerik.Reporting.Processing.SubReport sr = sender as Telerik.Reporting.Processing.SubReport;
    sr.Visible = (bool) (this.ReportParameters["ShowEmployees"].Value);
}

The code above doesn't work, and it gives me an error:
"An error has occurred while processing SubReport 'subReport1': Specified cast is not valid."

When I change the code to this:

private void subReport1_ItemDataBound(object sender, EventArgs e)
{
    Telerik.Reporting.Processing.SubReport sr = sender as Telerik.Reporting.Processing.SubReport;
    //sr.Visible = (bool) (this.ReportParameters["ShowEmployees"].Value);
    string str = this.ReportParameters["ShowEmployees"].Value.ToString();
    bool bVal = str == "= True";// it is always true (str.Length == 5);
    sr.Visible = bVal;
}

it seems to work, but when I switch to preview mode and change the radio button from True to False, nothing happens, looks like the value Never changes to False (it is always True).

What am I doing wrong? I just followed the sample coding shown in the video:

http://www.telerik.com/training.videos/24_Reporting_Subreports.zip

thanks for any help.
0
Stef
Telerik team
answered on 14 Feb 2013, 03:04 PM
Hi Wadigzon,

Your code will return the default set value for the report parameter, as it calls the report definition. In order to get the report parameters values passed by the user you need the report processing object:
private void subReport1_ItemDataBinding(object sender, EventArgs e)
      {
          Telerik.Reporting.Processing.SubReport sr = sender as Telerik.Reporting.Processing.SubReport;
          sr.Visible = (bool)(sr.Report.Parameters["ShowParameter"].Value);
      }
where sr.Report is Telerik.Reporting.Processing.Report.
The same can be achieved by binding the subReport item Visible property to the report parameter value. Both approaches are illustrated in the attached sample project.

I hope this helps.

All the best,
Stef
the Telerik team

HAPPY WITH REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
Wadigzon
Top achievements
Rank 1
answered on 14 Feb 2013, 03:41 PM
thanks!, that did the trick.
Tags
General Discussions
Asked by
Lior ef
Top achievements
Rank 1
Answers by
Peter
Telerik team
Lior ef
Top achievements
Rank 1
Kobus
Top achievements
Rank 1
Wadigzon
Top achievements
Rank 1
Stef
Telerik team
Share this question
or