Add DevExpress Document Viewer page and dependencies

Updated `_ViewImports.cshtml` to include DevExpress and DevExtreme tag helpers. Created `DocumentViewerDevExpress.cshtml` for displaying a DevExpress Document Viewer with necessary CDN links. Implemented the corresponding code-behind in `DocumentViewerDevExpress.cshtml.cs` to handle model binding and report key generation.
This commit is contained in:
OlgunR
2026-06-08 17:21:36 +02:00
parent 1cc617de42
commit bec9ea2356
3 changed files with 54 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
@page
@model DXApp.TemplateKitProject.Pages.Invoices.DocumentViewerDevExpressModel
@{
ViewData["Title"] = "DevExpress Document Viewer";
}
@* Dev: Für schnelle Tests verwenden wir die CDN-Assets.
In Production bitte lokal hosten und Lizenz einbinden. *@
<link rel="stylesheet" href="https://cdn3.devexpress.com/jslib/25.2.7/css/dx.common.css" />
<link rel="stylesheet" href="https://cdn3.devexpress.com/jslib/25.2.7/css/dx.light.css" />
<script src="https://cdn3.devexpress.com/jslib/25.2.7/js/dx.all.js"></script>
<script src="https://cdn3.devexpress.com/jslib/25.2.7/js/dx.aspnet.data.js"></script>
<div class="container-fluid" style="height:100vh; padding:0;">
<div class="d-flex align-items-center justify-content-between p-3 border-bottom">
<h5 class="m-0">DevExpress Viewer — Rechnung @Model.Id</h5>
<div>
<a class="btn btn-secondary me-2" href="/Invoices">Zurück zur Übersicht</a>
<a class="btn btn-outline-secondary" href="/Invoices/DocumentViewer?id=@Model.Id">Baseline Viewer</a>
</div>
</div>
<div style="height:calc(100vh - 64px);">
@* KORRIGIERTE SYNTAX: Der WebDocumentViewer-Helper wird direkt aufgerufen. *@
@(Html.DevExpress().WebDocumentViewer()
.Name("WebDocumentViewer")
.Height("100%")
.Width("100%")
.Bind(Model.ReportKey)
)
</div>
</div>

View File

@@ -0,0 +1,16 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace DXApp.TemplateKitProject.Pages.Invoices;
public class DocumentViewerDevExpressModel : PageModel
{
[BindProperty(SupportsGet = true)]
public int Id { get; set; }
public string ReportKey => $"invoice-{Id}";
public void OnGet()
{
}
}

View File

@@ -1,4 +1,10 @@
@using DXApp.TemplateKitProject
@using DXApp.TemplateKitProject.Pages
@namespace DXApp.TemplateKitProject.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@* --- DevExpress & DevExtreme Integration --- *@
@using DevExpress.AspNetCore
@using DevExpress.AspNetCore.Reporting
@using DevExtreme.AspNet.Mvc
@addTagHelper *, DevExtreme.AspNet.Core