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

Multiple reports in single Report Class Lib?

2 Answers 75 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Will
Top achievements
Rank 1
Will asked on 29 Oct 2007, 09:29 PM
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

2 Answers, 1 is accepted

Sort by
0
Svetoslav
Telerik team
answered on 30 Oct 2007, 03:17 PM
Hello Will,

As you already have a working solution, then you can use it without a problem. There are many ways you can achieve similar result. For example in our sample applications we have chosen a slightly different approach - we depend on reflection to instantiate the selected report. If you find it interesting you may take a look at both WinDemo and WebDemo applications.

I hope this information helps. Thank you.

Kind regards,
Svetoslav
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Will
Top achievements
Rank 1
answered on 30 Oct 2007, 03:37 PM
Hi,

Thanks for the feedback.  I'll take a look at the demo applications and see if that works better for me.

regards,
 will
Tags
General Discussions
Asked by
Will
Top achievements
Rank 1
Answers by
Svetoslav
Telerik team
Will
Top achievements
Rank 1
Share this question
or