As the title says i have a razor page with trhee buttons called ConverterComponent.razor that interacts with ConverterController.cs Is there a way i could show the .razor page in a list view in XAF? Here is the code:
@page "/Converter"
@inject IJSRuntime JS
@using System.Data
@using System.IO
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.Data.SqlClient
@using iExport.Module
@using System.Diagnostics
@using iExport.Module.BusinessObjects
@inject iExportEFCoreDbContext context
@inject ConverterController _controller
<DxFormLayout style="margin:15px;">
<!--Polaris-Mondial-->
<DxFormLayoutGroup Caption="Polaris Mondial" HeaderCssClass="header" ColSpanMd="4">
<DxFormLayoutItem BeginRow>
<label class="file-upload-btn">
Select File
<InputFile OnChange="@(e => HandleImportfrom("POLARIS-MONDIAL", e))" accept=".xls,.xlsx" />
</label>
</DxFormLayoutItem>
</DxFormLayoutGroup>
<!--Arag-->
<DxFormLayoutGroup Caption="Arag" HeaderCssClass="header" ColSpanMd="4">
<DxFormLayoutItem BeginRow>
<label class="file-upload-btn">
Select File
<InputFile OnChange="@(e => HandleImportfrom("ARAG", e))" accept=".csv" />
</label>
</DxFormLayoutItem>
</DxFormLayoutGroup>
<!--CNP-->
<DxFormLayoutGroup Caption="CNP" HeaderCssClass="header" ColSpanMd="4">
<DxFormLayoutItem BeginRow>
<label class="file-upload-btn">
Select File
<InputFile OnChange="@(e => HandleImportfrom("CNP",e))" accept=".xls,.xlsx"/>
</label>
</DxFormLayoutItem>
</DxFormLayoutGroup>
</DxFormLayout>
<style>
.header {
font-weight: bold !important;
font-family: Helvetica,sans-serif;
font-size: 1rem;
}
.file-upload-btn {
display: inline-block;
padding: 9px 12px;
font-size: 1rem;
background-color: #f4502d;
color: white;
border-radius: 5px;
cursor: pointer;
text-align: center;
}
.file-upload-btn input {
display: none;
}
</style>
@code {
protected override async Task OnInitializedAsync()
{
if (JS is null)
throw new InvalidOperationException("JSRuntime is not initialized.");
if (context is null)
throw new InvalidOperationException("Context is not initialized.");
}
private async Task HandleImportfrom(string buttonID, InputFileChangeEventArgs e)
{
var file = e.File;
var ms = new MemoryStream();
await file.OpenReadStream().CopyToAsync(ms);
ms.Position = 0;
try
{
await _controller.OpenFile(ms, file.Name.ToLower(), buttonID);
}
catch (Exception ex)
{
await JS.InvokeVoidAsync("ShowFileError", System.Threading.CancellationToken.None);
//throw new Exception($"{ex}");
}
}
}
i want to display the .razor page in a list view or detail view in xaf so i can access it with a navigation item
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744920156a4601082.html
评论列表(0条)