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

How to collapse a list when it has no data

7 Answers 92 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Don
Top achievements
Rank 1
Don asked on 14 May 2013, 06:06 PM
I have a list that sometimes has no data but its full height is blank even when it is empty.

I've tried conditional formatting and setting visibility to false when there are no items but still whitespace.

I've tried binding the height of the list to this expression =iif(Fields.PatientCases.Count = 0, ".01in", "1in") but no change.

Any other suggestions?

Thanks,
Don Rule

7 Answers, 1 is accepted

Sort by
0
IvanY
Telerik team
answered on 17 May 2013, 03:15 PM
Hi Don,

You can set the height of the item to 1px for example in the constructor of the report. That way you will be able to work easily in the designer since the height there will not be changed. However in runtime the height will be 1px initially and will become larger only if there is content in it. Please find below the code:
this.textBox1.Height = new Telerik.Reporting.Drawing.Unit(1.0);

All the best,
IvanY
the Telerik team

Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

0
Don
Top achievements
Rank 1
answered on 22 May 2013, 01:04 AM
I create my reports i the Designer and then upload them to a database and run them from my web site. It would not be practical to change the web site code in order to adjust the constructor for every new report.

There must be some way to do it with the Designer. 

Thanks,
Don
0
IvanY
Telerik team
answered on 24 May 2013, 01:20 PM
Hi Don,

In the designer you can simply use bindings, like this (actually you can use this workaround in visual studio too):
Height                     ='1px'

Regards,
IvanY
Telerik

Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

0
Sebastian
Top achievements
Rank 1
answered on 19 Sep 2013, 05:06 PM
This solution does not work.
I have tried your suggestion both the code behind and the design mode in a binging and I could not get the desired results.

Code Behind:
list5.Height = Telerik.Reporting.Drawing.Unit.Pixel(1);

Binding:
Height = "1px"

No solution.

Please help!
0
Nasko
Telerik team
answered on 20 Sep 2013, 03:38 PM
Hello Sebastian,

In Telerik Reporting, the default container behavior (such as the List item which contains a Panel item) is to always wrap its children. This means that the Panel will automatically grow if any of the containing items goes outside its bounds. The opposite is not possible - the Panel won't shrink if its content shrinks.

In order to achieve similar to the required result, we advice you to set the panel and the items inside in design time to have initial size small enough so that they always have to grow.

Regards,
Nasko
Telerik

Have you tried the new visualization options in Telerik Reporting Q2 2013? You can get them from your account.

0
Sebastian
Top achievements
Rank 1
answered on 23 Sep 2013, 08:41 PM
Hello Nasko, 

Thanks for your answer, but I have a problem.
In design mode, using the binding option and selecting the "Height" property to stablish the size of the list and panel in 1px, in runtime the application throws an exception and it says that the expressión "1px" is not valid.

How could I solve that?

Thanks
0
Nasko
Telerik team
answered on 26 Sep 2013, 02:17 PM
Hi Sebastian,

A little addition: Since you have a Panel item inside a List item, the Panel itself behave like it's docked to the List. Having this in mind, you will need to set both items' heights and the row height of the List to achieve the desired effect. To do that use the following code in the constructor of the report, after the InitializeComponent() method:
this.panel5.Height = Telerik.Reporting.Drawing.Unit.Pixel(1);
this.list5.Height = Telerik.Reporting.Drawing.Unit.Pixel(1);
this.list5.Body.Rows[0] = new TableBodyRow(Telerik.Reporting.Drawing.Unit.Pixel(1));

Regards,
Nasko
Telerik

Have you tried the new visualization options in Telerik Reporting Q2 2013? You can get them from your account.

Tags
Report Designer (standalone)
Asked by
Don
Top achievements
Rank 1
Answers by
IvanY
Telerik team
Don
Top achievements
Rank 1
Sebastian
Top achievements
Rank 1
Nasko
Telerik team
Share this question
or