Report viewer textbox visibility expression
Asked Answered
A

3

6

I am trying to get a text box and tablix to toggle their visibility based on an expression.

I have tried the following:

=IIF(First(Fields!Supported.Value, "FooDataSet") = "true", True, False)

However, this will not work for me. I'm using the 2010 version and using it in local mode.

I also tried writing custom code to see if that would work:

Public Function ToggleVisibility(ByVal visible As string) As Boolean
  Dim isVisible As Boolean = False
  If visible = "true" Then
    isVisible = True
  End If
  Return isVisible
End Function

Then I use it in the "Show or hide based on an expression" under the Visibility item in the text box and tablix properties.

=Code.ToggleVisiblity(First(Fields!Supported.Value, "FooDataSet"))

This also does not work for me.

Ataxia answered 19/4, 2013 at 17:39 Comment(1)
Hi, Please have a look at the answer provided below. Thats how the visibility of a textbox is set.Dunker
A
14

I see the visibility for a textbox and it worked.

I did the following

  1. Right Clicked the textbox control
  2. Clicked Textbox Properties... => Visibility
  3. Selected show or hide based on an expression and clicked the fx button
  4. In the expression editor, I added the following code.

=IIF(First(Fields!Author.Value, "DataSet1")="Romulus",true,false)

Note in this editor, you are setting the expression for Hidden and not Visibility, so be careful on passing the values. In my case since Romulus was not a Author, the condition was evaluated to false and the textbox was visible

Aba answered 19/4, 2013 at 18:19 Comment(0)
P
0

It should work even without IIF.

=First(Fields!Supported.Value, "FooDataSet") = "true"
Phlyctena answered 3/7, 2019 at 11:33 Comment(0)
D
0

I wasted an hour for this,

THE THING IS IT IS JUST hiding the report item IF YOUR EXP VALUE IS TRUE, and showing it if the exp value is false ...... WHICH IS frustrating

Diedra answered 2/8, 2020 at 13:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.