Adrian Caspe
Adrian Caspe

Reputation: 17

RDLC report C#. Show or hide controls thru conditioning

I'm new at using reporting tool and i can't figure out how to show/hide image in report. This is my code. Been playing with it for a while and I can't get right solution. Suppose i'm gonna hide it.

Microsoft.VisualBasic.Interaction.IIf(First(Fields![ES_EXCUSETYPE].Value, "DataSet1") = "1", True, False)

Upvotes: 0

Views: 1361

Answers (2)

Adrian Caspe
Adrian Caspe

Reputation: 17

UPDATE: The error was only the data type, i forgot that i set the value to INT and only converting it to string at the back end so i change "1" ----> 1 and fortunately it work :)

Microsoft.VisualBasic.Interaction.IIf(First(Fields![ES_EXCUSETYPE].Value, "DataSet1") = 1, True, False)

Upvotes: 0

tezzo
tezzo

Reputation: 11105

As you already know you have to set Hidden property of your Image using this syntax:

=IIf(<condition for hiding an object>, True, False)

If your Image is inside a Table detail you can use this syntax:

=IIf(Fields![ES_EXCUSETYPE].Value = "1", True, False)

If your Image is outside a Table detail you could use this syntax:

=IIf(First(Fields![ES_EXCUSETYPE].Value, "DataSet1") = "1", True, False)

That syntax only verify if the first record in Dataset meets the condition; so it is usually better to use a ReportParameter instead.

Upvotes: 1

Related Questions