ComponentOne ReportViewer for ASP.NET AJAX: ReportViewer for ASP.NET AJAX Task-Based Help > Switching Documents at Run Time

Switching Documents at Run Time

You can switch between different report documents on the client side at run time. For example, to switch between different documents on the client, you can add the following script to the page:

<script language="javascript" type="text/javascript">

function getReport() {

return $find("<%=C1ReportViewer1.ClientID%>")

}

function changeReport(fileName, reportName)

    {

        var c1Report = getReport();

        c1Report.set_fileName(fileName);

        c1Report.set_reportName(reportName);

        c1Report.generate();                     

    }

</script>

Then, you can use a link on the page, like in the following markup, to switch to a particular report:

<a href='javascript:changeReport("~/SpanningGroups.rdl", "")'>SpanningGroups</a>

Clicking this link will navigate to the selected report.


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.