📄 Documentation: BoldReport.cshtml


Table of Contents

  1. File Summary
  2. Overview & Purpose
  3. Dependencies & Technologies
  4. Key Functional Areas
  5. View Models & Data Flow
  6. API Endpoints Overview
  7. Helper Methods & Utilities
  8. Error Handling & Events
  9. Third‑party Integrations
  10. Sample Code Snippets
  11. Usage Examples
  12. UML Component Diagram
  13. Conclusion

1. File Summary

Path: IrbyImaging/Views/LegalImaging/BoldReport.cshtml
Type: Razor View (ASP.NET MVC)
Lines: 5

This view renders a Bold Reports report viewer component inside a custom report layout.


2. Overview & Purpose 🚀

The BoldReport.cshtml view is designed to display rich, interactive reports in the Legal Imaging section of the Irby Imaging web application. It:

  • Inherits from a shared report layout (_reportLayout.cshtml).
  • Embeds the bold-report-viewer Web Component.
  • Configures report source (report-path) and interaction callbacks for toolbar and export actions.

3. Dependencies & Technologies ⚙️

Technology Version/Notes Purpose
ASP.NET MVC (Razor) 5.x / .NET Framework Server‑side view rendering
HTML5 & CSS3 — Markup & styling
Bold Reports Viewer Custom Web Component Displays reports & toolbars
JavaScript ES5+ Event handlers and client logic
API: /api/ReportViewer Custom backend controller Fetches and processes report data

4. Key Functional Areas 🔑

Area Description
Layout Setup @{ Layout = "~/Views/Shared/_reportLayout.cshtml"; }
Viewer Container <div> wrapper with minimum height & full width style
Bold Reports Component <bold-report-viewer> tag with configuration attributes
Toolbar Callbacks onToolbarRendering, onToolBarItemClick handlers
Export Callbacks onExportItemClick handler

5. View Models & Data Flow 📦

  1. Controller Action

    • Sets ViewBag.ReportType (e.g., "LegalCaseSummary.rdl").
    • Returns this view.
  2. View Layer

    • Razor injects @ViewBag.ReportType into the report-path attribute.
    • Client‑side JavaScript hooks into onToolbarRendering, onToolBarItemClick, onExportItemClick.
  3. Backend API (/api/ReportViewer)

    • Receives AJAX calls from the viewer.
    • Processes report generation, export, and returns JSON/stream responses.

6. API Endpoints Overview 🔗

Endpoint Method Description
/api/ReportViewer POST Receives report parameters, returns report data or file streams.

Note: The viewer component issues AJAX requests to this endpoint under the hood.


7. Helper Methods & Utilities 🔧

Although BoldReport.cshtml is a lightweight view, the following helpers are typically defined in _reportLayout.cshtml or linked script files:

  • onToolbarRendering: Customize toolbar buttons before rendering.
  • onToolBarItemClick: Capture clicks on toolbar items (e.g., Print, Refresh).
  • onExportItemClick: Handle export format selection (PDF, Excel, CSV).
function onToolbarRendering(args) {
  // Example: Disable the 'Save' button if user lacks permission
  if (!userCanExport) {
    args.toolbarItems.forEach(item => {
      if (item.id === 'save') item.disabled = true;
    });
  }
}

8. Error Handling & Events 🚩

Event Trigger Recommended Handling
onToolbarRendering Before toolbar is rendered Validate permissions, customize UI
onToolBarItemClick When a toolbar button is clicked Logging, analytics, custom logic
onExportItemClick When user selects export format Validate format, show loader, error

Best Practices:

  • Graceful Fallback on API failure (display user-friendly message).
  • Loading Indicators while fetching or exporting reports.
  • Console Logging for debugging callback arguments.

9. Third‑party Integrations 🎉

  • Bold Reports: Powerful reporting engine integrated via a Web Component.
  • jQuery/Fetch API: Underlying AJAX mechanism for report data retrieval.
  • Bootstrap (via _reportLayout): Responsive styling and modal dialogs.

10. Sample Code Snippets 📊

10.1. Razor View

@{
    // Use the shared layout for consistent header/footer
    Layout = "~/Views/Shared/_reportLayout.cshtml";
}

<div style="min-height: 800px; width: 100%;">
    <bold-report-viewer
        id="viewer"
        report-path="@ViewBag.ReportType"
        report-service-url="/api/ReportViewer"
        toolbar-rendering="onToolbarRendering"
        tool-bar-item-click="onToolBarItemClick"
        export-item-click="onExportItemClick">
    </bold-report-viewer>
</div>

10.2. JavaScript Callbacks

<script>
    // Hook into the Bold Reports viewer events
    function onToolbarRendering(args) {
        console.log("Toolbar is rendering:", args);
    }

    function onToolBarItemClick(args) {
        console.log("Toolbar item clicked:", args.item.id);
    }

    function onExportItemClick(args) {
        console.log("Exporting report as:", args.format);
    }
</script>

11. Usage Examples 🛠️

Example 1: Display “CaseSummary.rdl” Report

public ActionResult ShowCaseSummary()
{
    ViewBag.ReportType = "LegalImaging/CaseSummary.rdl";
    return View("BoldReport");
}
  • URL: /LegalImaging/ShowCaseSummary
  • Result: Renders the report viewer with CaseSummary.rdl.

Example 2: Customizing Toolbar

function onToolbarRendering(args) {
    // Hide the export dropdown entirely
    args.toolbarItems = args.toolbarItems.filter(x => x.id !== 'export');
}

12. UML Component Diagram

graph LR
  A[Controller] --> B[BoldReport.cshtml]
  B --> C[bold-report-viewer Component]
  C --> D[/api/ReportViewer Endpoint/]
  D --> E[ReportController]
  E --> F[Report Generation Engine]
  • Controller → View: Passes ViewBag.ReportType.
  • View → Viewer Component: Binds attributes & events.
  • Viewer → API: AJAX calls for report data.
  • API → Engine: Generates & returns report content.

13. Conclusion 🎯

The BoldReport.cshtml view serves as a concise, declarative bridge between your ASP.NET MVC application and the Bold Reports engine. By embedding the <bold-report-viewer> component, you get:

  • Interactive Toolbars with customizable callbacks
  • Seamless Export to multiple formats
  • Easy Integration via a single Razor file

Leverage the provided callbacks, API endpoint, and layout to build, customize, and secure your reporting workflows within the Legal Imaging module.


Happy Reporting! 🚀