如何动态生成ReportViewer显示字段?

时间:2013-08-06 15:09:27

标签: asp.net rdlc report-viewer2010

我在Asp.Net网络表单中有一个带有LocalReport的ReportViewer,目前有四个占位符,每个占位符包含不同的字段。

我要做的是更改占位符:

[Name]
[Address1]
[Address2]
[CityStateZip]

更有条件的展示,例如:

[Name]
[Address1]
if(Address2 != null)[Address2] else [CityStateZip]
if(Address2 != null)[CityStateZip] else ""

我可以在rdlc中执行此操作吗?

1 个答案:

答案 0 :(得分:1)

是, 你可以用RDLC表达式中的iif做到这一点。 试试这个

=IIf(IsNothing(Fields!Address2.Value), Fields!Address2.Value, Fields!CityStateZip.Value)