Hello -
I am creating a module for a DNN site and my goal is to have a single page/user control for displaying the reports.
I created a Reports class library that currently has 5 reports, but this will grow as time goes by.
Currently, I have a drop-down list on the page that displays the list of reports that the user can select. Once they select and press a "Run" button, the selected report should run.
In the button's click event, I have a SELECT CASE statement (this is all vb.net) that sets the report based on the value the user picks.
Is there a better way or more preferred way to handle this type of situation? Note, there will be some parameters that are the same across all reports, and there are other parameters which do not appear on every report.
This my current code:
Select Case reportID ' the value from the report drop-down list
Case 1
Dim report as ReportLib.ReportOne = New ReportLib.ReportOne
report.param_Department = Me.DropDownList2.SelectedValue.ToString()
report.param_EndDate = Me.txtDate.Text.ToString()
Case 2
Dim report as ReportLib.ReportTwo = New ReportLib.ReportTwo
report.param_Department = Me.DropDownList2.SelectedValue.ToString()
Case 3
Dim report as ReportLib.ReportThree = New ReportLib.ReportThree
report.param_Department = Me.DropDownList2.SelectedValue.ToString()
report.param_TopValue = Me.txtTopvalue.text.toString()
End Select
thanks
- will
I am creating a module for a DNN site and my goal is to have a single page/user control for displaying the reports.
I created a Reports class library that currently has 5 reports, but this will grow as time goes by.
Currently, I have a drop-down list on the page that displays the list of reports that the user can select. Once they select and press a "Run" button, the selected report should run.
In the button's click event, I have a SELECT CASE statement (this is all vb.net) that sets the report based on the value the user picks.
Is there a better way or more preferred way to handle this type of situation? Note, there will be some parameters that are the same across all reports, and there are other parameters which do not appear on every report.
This my current code:
Select Case reportID ' the value from the report drop-down list
Case 1
Dim report as ReportLib.ReportOne = New ReportLib.ReportOne
report.param_Department = Me.DropDownList2.SelectedValue.ToString()
report.param_EndDate = Me.txtDate.Text.ToString()
Case 2
Dim report as ReportLib.ReportTwo = New ReportLib.ReportTwo
report.param_Department = Me.DropDownList2.SelectedValue.ToString()
Case 3
Dim report as ReportLib.ReportThree = New ReportLib.ReportThree
report.param_Department = Me.DropDownList2.SelectedValue.ToString()
report.param_TopValue = Me.txtTopvalue.text.toString()
End Select
thanks
- will