This is a migrated thread and some comments may be shown as answers.

Loading Reports Dynamically by Name

1 Answer 121 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 20 Jul 2009, 05:12 PM
I am trying to setup a asp.net page that can run a report based on a report name in the querystring. How can I make this happen?

I tried this
Dim ReportName As String = Request.QueryString("Report")  
        If ReportName IsNot Nothing Then 
            Dim r As Telerik.Reporting.Report = Activator.CreateInstance(Type.GetType("MyReportProject." & ReportName))  
            ReportViewer1.Report = r  
        End If 

But it doesn't seem to work. Any ideas?

1 Answer, 1 is accepted

Sort by
0
Jonathan
Top achievements
Rank 1
answered on 20 Jul 2009, 05:41 PM
Figured it out:
Dim r As Telerik.Reporting.Report = Activator.CreateInstance(Reflection.Assembly.Load("MyReportProject).GetType("MyReportProject." & ReportName)) 
Tags
General Discussions
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Jonathan
Top achievements
Rank 1
Share this question
or