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

Dynamic Details Section Height

7 Answers 709 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 11 Jan 2012, 10:40 PM
Hello,

In the report I am trying to make, each row in the dataset can have different types of data associated with it. 

i.e.  Record1 uses Data1,Data2,Data3.
Record2 uses Data3, Data4.

When displayed, Record1 would only show the Data1, Data2, and Data3 sections while hiding the Data4 section.  Likewise, Record2 would hide the Data1 and Data2 sections while displaying the Data3 and Data4 sections.

In other reporting systems, I was able to add multiple detail sections and hide them if the record did not use that type of data.  As I cannot have multiple detail sections in a single report, I was hoping to pack the data into panels and hide the panel if the data was not applicable to that record.  However, the details section's height does not automatically scale.  So for some records with virtually no data associated with them, a large blank area is still shown for that record.  I want to eliminate that.

Is there a way to trim the excess whitespace or is this type of report not supported?

7 Answers, 1 is accepted

Sort by
0
IvanY
Telerik team
answered on 12 Jan 2012, 05:43 PM
Hi Paul,

You can use Conditional Formatting Rules to hide the sections that have irrelevant data (you just have to set the Visible property to false) - when the item is invisible it does not take up space. For more information you can check our Conditional Formatting KB article.

All the best,
IvanY
the Telerik team

Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

0
Paul
Top achievements
Rank 1
answered on 12 Jan 2012, 07:08 PM
Thanks for the reply, but that isn't the problem I'm having.

I've attached an image which describes the problem.

For each record, there are several data items that we may or may not want to display.  They are the optional data panels.  If they are not wanted, the visible property is set to false.  That element then takes up no space.  That works very well.  But the problem is that the Detail section is a fixed size, taking up just as much space for each record, whether or not the record needs the space.

Is there some way I can get the Details section's height to vary between records?  Or is there another way I can get this effect?
0
Paul
Top achievements
Rank 1
answered on 16 Jan 2012, 02:19 PM
The question I have comes down to:

Can the details section's height vary per record item through either the designer or code-behind?

If not, is there another approach that would have a similar effect?
0
Elian
Telerik team
answered on 16 Jan 2012, 04:13 PM
Hi,

You can programmatically shrink the sections in the constructor after the InitializeComponent() call.

public Report1()
{
    //
    // Required for telerik Reporting designer support
    //
    InitializeComponent();
 
    this.detail.Height = Unit.Cm(0.01);
This will make the section as high as the items inside. Kind regards,
Elian
the Telerik team

Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

0
Paul
Top achievements
Rank 1
answered on 27 Jan 2012, 04:28 PM
I've figured out how to get my idea working. 

All that needs to be done is to add groups.  I've added many groups all grouping on the primary key.  Now I can set up the different displaying conditions I wanted, each in its own group, and use conditional formatting to only set the visible = true property to the single group I want to display. 

That's the behavior I was looking for.  So now I can have each group whatever size I want it and there is no whitespace added to the report if I hide the group.
0
Shane
Top achievements
Rank 1
answered on 06 Apr 2015, 03:48 PM
How would you do this with the MVC implementation? The report is created on the html page, and I do not use an InitializeComenent() for each report.
0
Nasko
Telerik team
answered on 09 Apr 2015, 10:53 AM
Hello Shane,

With the MVC Report Viewer you need to use a custom report resolver, where you can create and modify the report object. For more information, please refer to the How To: Implement a Custom Report Resolver help article.

Regards,
Nasko
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
General Discussions
Asked by
Paul
Top achievements
Rank 1
Answers by
IvanY
Telerik team
Paul
Top achievements
Rank 1
Elian
Telerik team
Shane
Top achievements
Rank 1
Nasko
Telerik team
Share this question
or