📝 GCLicenseReport.cshtml Documentation
Table of Contents
- Overview & Purpose
- Dependencies & Technologies
- View Model & Data Models
- Key Functional Areas
4.1. Layout & Structure
4.2. Styling & Theming
4.3. Grid Configuration
4.4. Buttons & Toolbar
4.5. JavaScript Logic & Events - Third-Party Integrations
- Sample Usage & Code Snippets
- UML Class Diagram
- Conclusion
1. Overview & Purpose 🚀
File: IrbyImaging/Views/LegalImaging/GCLicenseReport.cshtml
Type: ASP.NET Core Razor View (UI Layer)
This view renders a General Contractor License Report using a rich data grid powered by Syncfusion EJ2.
It displays license details—such as state, license number, classifications, issue/expiration dates—and offers interactive features like:
- Sorting & Grouping
- Excel-style Filtering
- Excel Export
- Search & Clear Search
🎯 Intended Use:
In your MVC Controller, return this view along with a LicenseReport model (or a collection thereof) via ViewBag.datasource or strongly‑typed model binding.
2. Dependencies & Technologies 🔧
| Layer | Technology / Library |
|---|---|
| ASP.NET Core MVC | Razor Views |
| JavaScript UI | Syncfusion EJ2 Grid & Buttons |
| Styling | Bootstrap 4, Custom CSS |
| Data Model | IrbyImaging.DomainClasses |
| Build & Packaging | .NET Core / .NET 5+ |
Note: Ensure you include the Syncfusion EJ2 scripts & styles in your
_LegalLayout.cshtmlor_Layout.cshtml.
3. View Model & Data Models 📊
LicenseReport Domain Class (Simplified)
| Property | Type | Description |
|---|---|---|
| State | string |
US State code (e.g., “CA”, “NY”) |
| LicenseNumber | string |
Unique license identifier |
| LicenseClassifications | string |
Description of licensed classifications |
| ClassificationCodes | string |
Abbreviated classification codes |
| IssuingParty | string |
Agency or body that issued the license |
| DateAcquired | DateTime |
Date license was acquired |
| Status | string |
Current license status (Active/Expired) |
| ExpirationDate | DateTime |
License expiration date |
| RenewalStatus | string |
Renewal pending/complete |
| Qualifiers | string |
Additional qualifiers or notes |
In the view, the @model directive ties the Razor file to LicenseReport, but the grid expects a collection—passed via ViewBag.datasource.
4. Key Functional Areas 🔍
4.1. Layout & Structure 🏗️
@model IrbyImaging.DomainClasses.LicenseReport
@using Syncfusion.JavaScript
@using Syncfusion.EJ2
@{
ViewData["Title"] = "General Contractor Licenses";
Layout = "~/Views/Shared/_LegalLayout.cshtml";
}
- Layout: Inherits from
_LegalLayout.cshtml - Title: Set to “List” (renders in browser tab & header if layout uses it)
4.2. Styling & Theming 🎨
<style>
.e-grid .e-gridheader { border: 2px solid black; }
.e-grid .e-headercell { color: darkblue; }
.e-grid .e-sortnumber { background-color: #deecf9; font-family: cursive; }
/* ...more custom Syncfusion overrides... */
</style>
- Custom CSS adjusts the Syncfusion Grid theme:
- Header borders & text color
- Group caption backgrounds
- Icon overrides using
::beforecontent codes
4.3. Grid Configuration 📈
<ejs-grid id="Grid"
dataSource="@ViewBag.datasource"
allowSorting="true"
allowGrouping="true"
allowFiltering="true"
filterSettings="@(new FilterSettings() { FilterType = FilterType.Excel })"
toolbar="@(new List<string>() { "ExcelExport", "Search" })"
allowExcelExport="true"
allowPaging="true"
allowTextWrap="true"
allowRowDragAndDrop="true">
<e-grid-editSettings allowAdding="true"
allowEditing="true"
allowDeleting="true"
edit-mode="@(EditMode.Normal)">
</e-grid-editSettings>
<e-grid-columns>
<e-grid-column field="State" headerText="STATE" isPrimaryKey="true"></e-grid-column>
<e-grid-column field="LicenseNumber" headerText="LICENSE NUMBER" isPrimaryKey="true"></e-grid-column>
<!-- ...other columns defined similarly... -->
</e-grid-columns>
</ejs-grid>
Columns Overview
| Field | Header Text | Alignment | Primary Key |
|---|---|---|---|
| State | STATE | Left | ✔️ |
| LicenseNumber | LICENSE NUMBER | Left | ✔️ |
| LicenseClassifications | LICENSE CLASSIFICATION(S) | Left | ✔️ |
| ClassificationCodes | CLASSIFICATION CODE(S) | Center | |
| IssuingParty | ISSUED BY | Left | |
| DateAcquired | ACQUIRED ON | Left | |
| Status | STATUS | Left | |
| ExpirationDate | EXPIRES ON | Left | |
| RenewalStatus | RENEWAL STATUS | Left | |
| Qualifiers | QUALIFIER(S) | Left |
4.4. Buttons & Toolbar 🔘
<ejs-button id="clear" content="Clear Search"></ejs-button>
<ejs-grid ... toolbar="@( new List<string>() {"ExcelExport","Search"} )">
- Clear Search: Custom button to reset search query
- Toolbar:
- ExcelExport: Exports the grid to an Excel file
- Search: Provides a built‑in search box above the grid
4.5. JavaScript Logic & Events ⚙️
<script>
// Clear the search filter on button click
document.getElementById('clear').addEventListener('click', () => {
let gridObj = document.getElementById("Grid").ej2_instances[0];
gridObj.searchSettings.key = '';
});
// Handle toolbar button clicks (e.g., Excel Export)
function toolbarClick(args) {
let gridObj = document.getElementById("Grid").ej2_instances[0];
if (args.item.id === 'Grid_excelexport') {
gridObj.excelExport();
}
}
</script>
clearevent: Resets the search keytoolbarClick: Intercepts the Excel Export toolbar event
5. Third-Party Integrations 🔗
- Syncfusion EJ2: Provides rich UI components
- Bootstrap 4: Facilitates responsive grid & card layout
Tip: Ensure your project has valid Syncfusion licenses and scripts (JS/CSS) included.
6. Sample Usage & Code Snippets 💡
Controller Action Example
public class LegalImagingController : Controller
{
private readonly ILicenseService _licenseService;
public LegalImagingController(ILicenseService licenseService)
{
_licenseService = licenseService;
}
public IActionResult GCLicenseReport()
{
var reportData = _licenseService.GetAllLicenses();
ViewBag.datasource = reportData;
return View(reportData);
}
}
Invoking the View
<!-- Renders the Syncfusion Grid -->
@Html.Partial("GCLicenseReport", Model)
7. UML Class Diagram 📐
@startuml
class LicenseReport {
+ string State
+ string LicenseNumber
+ string LicenseClassifications
+ string ClassificationCodes
+ string IssuingParty
+ DateTime DateAcquired
+ string Status
+ DateTime ExpirationDate
+ string RenewalStatus
+ string Qualifiers
}
class GCLicenseReport.cshtml <<View>> {
+ RenderGrid()
+ ClearSearch()
+ ExportToExcel()
}
LicenseReport <|-- GCLicenseReport.cshtml : uses
@enduml
Generate this diagram using PlantUML.
8. Conclusion 🎉
The GCLicenseReport.cshtml Razor view offers a powerful, interactive data‑driven UI for presenting and managing General Contractor license information.
By leveraging Syncfusion EJ2 components, it provides end-users with:
- Rich sorting, grouping, and filtering 🧐
- On‑the‑fly Excel exports and searches 🔍
- Seamless integration into ASP.NET Core MVC
Implement this view in your LegalImaging area to ✅ boost data visibility, ✅ accelerate reporting, and ✅ maintain clean, modern UIs.
Happy coding! 🚀