I have built a generalized report viewer page, with up to 50 potential reports to select from, depending on the context.
I realize that each report is a "class" and therefore you cannot just treat it like you would assign a value to a parameter.
But I'm wondering if there is a way to replace this select and the hard-coding of the report classes, into something more dynamic.
I've tried to move the SQL setup outside the case logic, reducing the repeated lines by half, but the report object loses scope outside the case statement, and the compiler balks.
I've seen another thread that does something similar with C, but I don't know enough to translate it into VB. (VS2010)
line 2
I realize that each report is a "class" and therefore you cannot just treat it like you would assign a value to a parameter.
But I'm wondering if there is a way to replace this select and the hard-coding of the report classes, into something more dynamic.
I've tried to move the SQL setup outside the case logic, reducing the repeated lines by half, but the report object loses scope outside the case statement, and the compiler balks.
I've seen another thread that does something similar with C, but I don't know enough to translate it into VB. (VS2010)
Select Case Me.Report_Selection_Combo.SelectedValue
Case "publication_summary_report"
Dim report1 As New Publication_Summary_Report
ReportViewer1.Report = report1
Dim sqlDataSource1 As Telerik.Reporting.SqlDataSource = DirectCast(report1.DataSource, Telerik.Reporting.SqlDataSource)
sqlDataSource1.SelectCommand = StrConv(HttpContext.Current.Session("sql_select"), VbStrConv.Lowercase)
Case "publication_standard_report"
Dim report1 As New Publication_Standard_Report
ReportViewer1.Report = report1
Dim sqlDataSource1 As Telerik.Reporting.SqlDataSource = DirectCast(report1.DataSource, Telerik.Reporting.SqlDataSource)
sqlDataSource1.SelectCommand = StrConv(HttpContext.Current.Session("sql_select"), VbStrConv.Lowercase)
Case "publication_catalog_report"
Dim report1 As New Publication_Catalog_Report
ReportViewer1.Report = report1
line 2