Show/Hide Field Label

Stimulsoft Reports.NET discussion
MikeC
Posts: 51
Joined: Mon Jun 07, 2010 3:36 pm

Show/Hide Field Label

Post by MikeC »

I have a field label (Text54) that is next to a field with an expression in it (Text13). The expression is as follows {Substring(ContractOwners,0,(int)Length(ContractOwners)-2)} . The expression lists out contract owners, and ContractOwners is a variable where I'm capturing the names. Not all records have contract owners, so if the expression in Text13 doesn't have any data, or Text13 is empty I want to hide the label (Text 54).

I tried several things including conditions, but couldn't make Text54 appear when Text13 is populated or disappear when Text13 is empty. What do I need to do to turn Text 54 on or off depending on the contents of Text13.

Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Show/Hide Field Label

Post by Alex K. »

Hello,

Please send us your report with test data for analysis.

Thank you.
MikeC
Posts: 51
Joined: Mon Jun 07, 2010 3:36 pm

Show/Hide Field Label

Post by MikeC »

I can't send you a copy of the report with the data, since it contains sensitive information.

It should be simple-I just need to show or hide a label based on the contents of it's associated data field. If the data field is empty I want the label to hide. If there is data in the data field I want the label to show. Can't Stimulsoft do something that simple?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Show/Hide Field Label

Post by Alex K. »

Hello,

You can use Conditions - if data empty then set the ComponentIsEnabled property to false.

Thank you.
nicegaurav
Posts: 91
Joined: Mon Oct 15, 2012 10:03 am

Re: Show/Hide Field Label

Post by nicegaurav »

can u plz let me know, how to show and hide labels dynamically, On C# code can we access the reports instances like property or methods through which we can achieve this...

this is urgent ..... thanx in advance
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Show/Hide Field Label

Post by Alex K. »

Hello,

You can use the following code:

Code: Select all

Stimulsoft.Report.Components.StiText text1 = report.GetComponents()["Text1"] as StiText;
text1.Enabled = false;
Thank you.
nicegaurav
Posts: 91
Joined: Mon Oct 15, 2012 10:03 am

Re: Show/Hide Field Label

Post by nicegaurav »

Thanx for ur great help... it's working ,

But there is another issue, If we do enable false for a label, the space taken by the label remain same
can we fill the empty space by the adjacent control :?:

Thanks
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Show/Hide Field Label

Post by HighAley »

Hello.

Please, send us your report template with data for analysis.

Thank you.
nicegaurav
Posts: 91
Joined: Mon Oct 15, 2012 10:03 am

Re: Show/Hide Field Label

Post by nicegaurav »

This is the scenario

First i have created a .mrt file(report), with some labels like

|-------------------------------|
| lbl1 lbl2 |
| lbl3 lbl4 |
| lbl5 lbl6 |
| lbl7 lbl8 |
| lbl9 lbl10 |
| lbl11 lbl12 |
|-------------------------------|

I put some value on the label at the time of report creations and now I want to do enable false lbl1 and lbl2 on c# code,
with the help of above code achieved this.Both the labels are not displaying when report creates in pdf format. But when the labels (lbl1 and lbl2) are disable, the first row sets blank and empty row displays. I want to shift second row at first place, third row at second, fourth row at third and so on....
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Show/Hide Field Label

Post by Alex K. »

Hello,

Please try to set the CanShrink property to true.

Thank you.
Post Reply