报表查看器文本框可见性表达式 [英] Report viewer textbox visibility expression

查看:224
本文介绍了报表查看器文本框可见性表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取一个文本框和tablix,以根据表达式切换其可见性.

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

我尝试了以下操作:

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

但是,这对我不起作用.我正在使用2010版本,并在本地模式下使用它.

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

然后在文本框和tablix属性的可见性"项目下的基于表达式显示或隐藏"中使用它.

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"))

这对我也不起作用.

推荐答案

我看到了文本框的可见性,并且可以正常工作.

I see the visibility for a textbox and it worked.

我做了以下

  1. 右键单击文本框控件
  2. 单击的文本框属性... =>可见性
  3. 根据表达式选择显示或隐藏,然后单击fx按钮
  4. 在表达式编辑器中,添加了以下代码.

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

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

请注意,在此编辑器中,您正在为隐藏而不是可见性设置表达式,因此在传递值时要小心.在我的情况下,由于Romulus不是作者,因此条件被评估为 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

这篇关于报表查看器文本框可见性表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆