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

Is it possible to render a single report item?

3 Answers 60 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Julian
Top achievements
Rank 1
Julian asked on 28 Aug 2012, 02:50 PM
Let's say I have a report that contains a table, and a bar chart and a pie chart. Is it possible for me to render each item separately?

The reason I'm asking is so that a user can choose which tables and charts to include in a report.

Thanks

PS: This is for ASP.NET

3 Answers, 1 is accepted

Sort by
0
Chris Gillies
Top achievements
Rank 1
answered on 28 Aug 2012, 02:59 PM
Each item has Visible property which can be controlled via binding expression. The easiest way to go would be to create the report layout with all possible items and nest each item in a Panel (this is to maintain the original layout when you hide one item). Then you can let the user control which ones to see by report parameters e.g. the binding for the Visible property can depend on a Boolean report parameter, which the user can operate with.

Cheers
0
Julian
Top achievements
Rank 1
answered on 29 Aug 2012, 06:27 AM
Thanks for the reply.

As you describe is how I am performing the task at the moment, though with one slight difference; all the controls that I hide are not necessarily nested in a panel. For instance I may make a chart itself 'Visible.False'.

The problem is that after hiding various elements, the subreport does not shrink to fit the remaining elements - there may be a lot of space below the subreport before the next subreport begins.

Do you have a solution for this? If I instead hid panels, would that fix the problem?

Thanks
0
IvanY
Telerik team
answered on 03 Sep 2012, 03:14 PM
Hello Julian,

Placing them in a Panel will not fix that issue. However you can still achieve that effect, but requires a little bit of work. You will have to place this snippet in each subreport you have:
public MySub1()
{
    InitializeComponent();
 
    this.detail.Height = Unit.Pixel(1);
}

This will ensure that the detail section will grow only in runtime, if there is something to show. Add the same line in the constructor of your master report if needed.

Greetings,
IvanY
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

Tags
General Discussions
Asked by
Julian
Top achievements
Rank 1
Answers by
Chris Gillies
Top achievements
Rank 1
Julian
Top achievements
Rank 1
IvanY
Telerik team
Share this question
or