Download
Source
Non-administrative users first see a listing of the reports
available on this portal. Using a datagrid, users see a link button and the
display name of the report. The display name shows a user friendly name (from
the field ReportDispName). We store the actual file system report name in the
field ReportName.
To display this list, we use the objects created earlier in
the DAL and BLL layers. In the project source code under desktopmodules, the
folder called CrystalReportManager has our project in it. The Web User Control
ReportsViewer.ascx contains the listing of reports and the viewer. In the
Page_Load event of the control, a datagrid (dg_ReportsList) is instantiated
with a listing of all reports for this Portal Id. See Code Listing 1 for the
code used to call the listing of reports.
Code Listing 1
if (!IsPostBack)
{
lblError.Text="";
try
{
PortalSettings oPortal = new
PortalSettings();
Lancor.CrystalReportManager.ReportsController
oReportConroller = new ReportsController();
dg_ReportsList.DataSource=oReportConroller.GetReports(
oPortal.PortalId);
dg_ReportsList.DataBind();
}
catch(Exception ex)
{
lblError.Text= ex.Message;
}
}
Using DotNetNuke's custom Portal Settings objects, we can
get the current Portal ID to pass to the GetReports method. Then, we bind the
data from the BLL oReportController to the datagrid, in this instance named
dg_ReportsList.