Click here to Skip to main content
15,901,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Below is the code I am using:
C#
protected void ReportViewer1_Drillthrough(object sender, DrillthroughEventArgs e)
       {
           LocalReport localReport = (LocalReport)e.Report;
           localReport.DataSources.Add(new ReportDataSource("InfosourceReportsDS"));
       }


Below is the aspx for reportviewer:
XML
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt"
            Height="800px" ProcessingMode="Remote" Width="1075px"
            ShowPrintButton="false" ExportContentDisposition="AlwaysInline"
            ondrillthrough="ReportViewer1_Drillthrough">
            <ServerReport ReportServerUrl="" />
            <LocalReport EnableHyperlinks="True">
            </LocalReport>
</rsweb:ReportViewer>


I am getting the below exception in the Drillthrough event at the below statement:
LocalReport localReport = (LocalReport)e.Report;

Exception:
cast Microsoft.Reporting.WebForms.ServerReport' to type 'Microsoft.Reporting.WebForms.LocalReport'
Posted

1 solution

'cast Microsoft.Reporting.WebForms.ServerReport' to type 'Microsoft.Reporting.WebForms.LocalReport' .'
Error itself is telling the reason. You are trying to cast a ServerReport to a LocalReport.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900