如何在.NET Reporting RDLC中的某些条件下隐藏或不打印页面 [英] How to hide or not print a page on certain condition in .NET Reporting RDLC

查看:85
本文介绍了如何在.NET Reporting RDLC中的某些条件下隐藏或不打印页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个报告,其中我得到了三个分组.在某些情况下,我显示明细''行,例如我在状态"为"True"的详细信息组中创建了一个过滤器,并在页脚中显示了它们的总数.而Status = False则用于页面上的其他计算.
因此,我不能仅将数据源查询修改为仅包含Status = True的行.所有行都是必需的.

现在我的问题是,如果没有任何行,其中Status = True,那么仍然生成带有页眉,无行且页脚总计= 0的页面.如果没有显示的详细信息并且总计= 0,我不想生成页面.

I have a report where I have got three groupings.I display details'' rows on certain condition e.g. I created a filter in details group where Status = True and display their total in page footer. Whereas Status = False is used for other calculations on page.
So I cannot just modify the datasource query to only have rows where Status = True. All the rows are required.

Now my problem is if there are no rows where Status = True, then still the page gets generated with header, no rows and total = 0 in footer. I do not want to generate a page if there are no details displayed and the total = 0.

Is there a way we can control the conditional visibility of a page in RDLC reports?

推荐答案

嗨Azeeth,

您可以通过两种方式来做到这一点.您都可以在后面的代码中检查条件.如果一切正常,则仅显示报告.否则,您可以编写表达式来表示要隐藏的表的可见性.这将加载报告查看器.但是可以根据条件隐藏表.

对于第二个选项.
右键单击表格.
单击可见性"选项卡.
单击单选按钮Expression.
写像 = iif(condition,true,false)
这样的表达式
快乐编码
:)
Hi Azeeth,

You can do it in two ways. Either you can check your conditions in your code behind. If evrthing is ok, thn only display the report. Or else you can write expressions for the visibility of the tables which you want to hide incase of your situations. This will load the report viewer. But can hide the tables based on the condions.

For Tthe 2nd option.
Right click on the table.
Click the tab Visibility.
Click the radio button Expression.
Wirte the expression like =iif(condition, true, false)

Happy Coding
:)


这篇关于如何在.NET Reporting RDLC中的某些条件下隐藏或不打印页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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