RDLC 报告:在报告查看器中显示时查找每页的超链接

RDLC reports : find hyperlinks per page when displayed in reportViewer

我是 Microsoft 报告方面的新手,需要一些帮助!这是上下文:

我们正在根据数据集格式化 rdlc 报告,我们使用 reportViewer 对象将其显示在 aspx 页面中。我们需要在调用另一个页面或 Web 服务的报告中包含 hyperlinks(尚未决定)。 hyperlinks 位于 table 单元格内的特定类型的数据上,我们称它们为 ID。一个报告页面可以包含很多或不包含 hyperlink,这取决于获得的数据集。

到目前为止没问题,但问题是:我们需要将 ID 列表传递给 page/web 服务,其中包含报告页面中的所有可用 ID .所以我需要一种方法来扫描格式化报告的页面以获取该 ID 列表。怎么样?

到目前为止,我尝试过:

我想试试:

我面临的问题确实是 "per page" 问题。你这样做了吗?最好的方法是什么?

非常感谢!

编辑: 忘了提及报告在渲染之前对数据集执行了多个分组,所以我无法通过计算每页的 x 个元素来估计页面中显示的数据。它需要在数据集被 rdlc 咀嚼后完成...

我理解你的 "per page" 问题。可以用 javascript 方法解决,我没有遇到你的问题

The javascript is executed when I click the hyperlink, but the function defined in the aspx page is not found.

如果您想进一步研究这条路径,请告诉我。

我的首选解决方案使用不同的方法:设置每页的固定行数,然后在自定义代码函数中,使用 Vb Take 和 Skip 函数以及当前页码,您可以获得当前显示的从大数据集中排出来。您终于在超链接操作中使用了它们。

我对此进行了测试,效果很好。 Here's a screenshot and the working RDL and corresponding dataset(在 RDLC 中使用相同的东西应该可以正常工作)

* 来自 mockaroo.com

的模拟数据

我的另一个解决方案使用 dom 遍历 jquery。

我添加了一个列 header,其中包含一些挂钩文本 (="@HOOK@") 以帮助我找到 table。如果 table 不是 suitable,您可以找到其他方法来检测您的 table。 I also made sure header stays visible during paging.

遍历table的代码定义在aspx页面中,调用using go to url using ="javascript:functionName()"

Screenshot of working example(问我是否要我上传工作项目)

解决方案:

Aspx 页面

<form runat="server">
<asp:scriptmanager runat="server"></asp:scriptmanager>
    Your aspx page : 
    <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" Height="585px" Width="1007px">

        <LocalReport EnableHyperLinks="true" ReportPath="Report1.rdlc">
            <DataSources>
                <rsweb:ReportDataSource Name="DataSet1" DataSourceId="ObjectDataSource1"></rsweb:ReportDataSource>
            </DataSources>
        </LocalReport>
    </rsweb:ReportViewer>

    <asp:objectdatasource runat="server" selectmethod="GetData" typename="Whosebug1.ToolsDataSetTableAdapters.MOCK_DATATableAdapter" id="ObjectDataSource1"></asp:objectdatasource>
</form>
<script>
    function getCurrentIds() {
        //get latest table containing my hook
        var data = $("table:contains('@HOOK@')").eq(-1).find("tr").map(function (index) {
            if (index > 1) {
                $row = $(this);
                //hide the hook and find the contents of the second td
                $row.find("td:first").hide();
                var id = $row.find("td:nth-of-type(2)").text();
                // console.log(id);
                return id;
            }
        }).get();
        return data.join(",");
    }
</script>

转到 url 操作

="javascript:alert('current page ids using javascript :' + getCurrentIds())"