rdlc报表开发是以DataSet为基础的,所以首先你得新建一个xsd文件,在xsd文件里添加DataTable.

接下来新建rdlc文件,拖入Table控件,向导会提示你建数据源,选择DataSet,以及给DataSet命名(这个名字需要与程序中对应)

rdlc的文本的值支持多语言的写法:

=IIF(Parameters!Language.Value="zh-CN","区域","Region")

=IIF(Parameters!Language.Value="zh-CN",Fields!RegionCN.Value,Fields!RegionEN.Value)

若要执行脚本,请选中此文本框,右键文本框属性,Action,Go to URL,Select URL其表达式为:= "javascript:ViewStoreLicense("& Fields!StoreLicenseId.Value &")",然后页面中要有对应的javascript函数,如下:

<script type="text/javascript">
        function ViewStoreLicense(StoreLicenseId) {
            var x = screen.width / 2 - 800 / 2;
            var y = screen.height / 2 - 600 / 2;
            window.open("../LicenseManager/StoreLicenseInfo.aspx?Action=5&BusinessDataID=" + StoreLicenseId, "StoreLicense", "location=1,status=1,scrollbars=1, left=" + x + ",top=" + y + ", width=800,height=600");
        }
    </script>

页面中:

<rsweb:ReportViewer ID="rpViewer" runat="server" Width="100%" Font-Names="Verdana"
                    Font-Size="8pt" ShowDocumentMapButton="False" ShowRefreshButton="False" ShowZoomControl="False"
                    SizeToReportContent="True" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt"
                    HyperlinkTarget="_self" BackColor="Transparent" BorderColor="Transparent"
                    ShowPrintButton="False">
                    <LocalReport EnableHyperlinks="True">
                    </LocalReport>
</rsweb:ReportViewer>

            rpViewer.LocalReport.ReportPath = @"bin\Forms\Report\StoreList.rdlc";
            rpViewer.LocalReport.SetParameters(new ReportParameter("Language", Language));
            rpViewer.PageCountMode = PageCountMode.Actual;
            DataTable dtMain = CAReport.GetCompliancedStoreList(LicenseTypeId, StoreNo);

            if (dtMain.Rows.Count > 0)
            {
                rpViewer.LocalReport.DataSources.Clear();
                ReportDataSource rds = new ReportDataSource("objReportCN", dtMain);
                rpViewer.LocalReport.DataSources.Add(rds);
                rpViewer.LocalReport.Refresh();
            }

隔行换色:

选中一个TextBox,设置其BackgroundColor=IIF(RowNumber(nothing) mod 2 = 0, "#d3f0ff", "Transparent")