33,317 questions
Tooling
0
votes
0
replies
7
views
How to enable Razor/Blazor LSP support in Neovim using lazy.nvim?
I am currently using lazy.nvim to manage my plugins and csharp-language-server for C# development. While C# files work perfectly, I cannot get LSP features (completions, diagnostics, or go-to-...
0
votes
0
answers
67
views
Simplest / lowest overhead method for including server generated variables in IIS webpages
This is possibly a dumb question.
I have a .NET 8 web application that is entirely service based; the pages themselves are pure static HTML, and all dynamic content of any kind is loaded via fetch ...
Tooling
0
votes
0
replies
31
views
C# style rules defined in .editorconfig are ignored in Razor code blocks
I am setting up an .editorconfig file to enforce certain conventions and code styles.
I have noticed that C# style rules only seem to apply to *.cs files and not Razor C# code blocks.
Take, as an ...
1
vote
1
answer
95
views
ASP.NET Core MVC : get form text info to a controller
I'm trying to get a form to pass a person's name to a controller, and from there, display that person's LARP character info. Right now I'm only passing the character's name, class, species, and image ...
1
vote
1
answer
65
views
How to fix 2sxc (v20.0.8) AppCode HotBuild compile error — AppCode.dll not generated
I'm having an issue when creating a new view in a 2sxc app (version 20.0.8).
Whenever 2sxc tries to generate the datamodels / compile the AppCode, the HotBuild process fails.
It looks like 2sxc is not ...
4
votes
0
answers
85
views
Embedded Views in ASP.NET Core 10
Previously, in .NET 9 and lower, we could use RazorRuntimeCompiliation to implement embedded views in assemblies.
services.Configure<MvcRazorRuntimeCompilationOptions>( options =>
{
var ...
1
vote
1
answer
215
views
Problem with Roslyn configuration on neovim
I've been trying to setup roslyn.nvim with rzls.nvim on my neovim for a while to work with .NET, C# and Blazor. But I've been facing some frustrating problems, I'm using WSL Ubuntu 24.04, a neovim ...
-2
votes
0
answers
61
views
Why can PropertyColumns not infer their type parameters when passed to a wrapper? [duplicate]
I am using MudBlazor's MudDataGrid, which functions very similarly to Blazor's QuickGrid. The grid's contents are determined by a RenderFragment parameter called Columns, which contains a list of ...
0
votes
1
answer
104
views
Blazor auto render mode prerender flicker problem even though pages use persistence
There are two pages in my app:
Page1.razor (home) and Page2.razor. There is no problem rendering first page. But when I navigate to second page, there is flicker problem. I put 1000 ms sleep to better ...
0
votes
0
answers
53
views
TLS issues with ActionMailer.Net [duplicate]
I have an ASP.NET MVC application, that uses the following package
ActionMailer.net
This has been going beautifully for many years, but lately we have been hitting issues with the mail servers we have ...
-2
votes
2
answers
96
views
How to use gorazor and iterate over a slice
I want to use gorazor a viewengine written in go that uses razor-Syntax. They provide an example which i tried to understand and adapt.
What is working
I want to iterate over a slices of movies and ...
-3
votes
1
answer
79
views
Error with onblur, There is no argument given that corresponds to the required parameter 'e' [closed]
I get the error,
There is no argument given that corresponds to the required parameter
'e' of 'AddContributor.OnPayerIdChangedAsync(ChangeEventArgs)'
This is the pertinent area of blazor markup:
<...
1
vote
0
answers
89
views
Visual Studio create new custom Scaffold Item for Razor WebApp
Summary:
I want to create a new scaffold item for Visual Studio in my Razor app so that I do not have to edit every CRUD page to use my custom libraries. I have spent the last 2 days letting ChatGPT ...
1
vote
0
answers
55
views
How to disable the pink Razor feature warnings in Visual Studio?
I'm working on an ASP.NET Core MVC project in Visual Studio 2022.
Lately, I keep seeing these warning messages at the top of the editor:
Feature 'Razor Diagnostics Feature' is currently unavailable ...
1
vote
1
answer
102
views
.razor code not recognized (even in new blazor project)
Opened a blazor project for the first time in a while and suddenly no code or components are recognized (even on newly created projects):
When I hover over components no auto-completion suggestions, ...
3
votes
4
answers
144
views
Why does this Razor code compile even though I reuse the same loop variable name in nested foreach
I am writing a Blazor component and noticed something unexpected. In my Razor code, I use a foreach to loop over a list, and inside the Click event handler of a RadzenButton I declare another foreach ...
0
votes
2
answers
127
views
Blazor Server: Custom 404 component causes RenderFragment<T> error with InteractiveServer render mode
I'm trying to use a custom 404 component in a Blazor Server app with this router setup:
<Router AppAssembly="@typeof(App).Assembly" @rendermode="InteractiveServer">
<...
2
votes
2
answers
158
views
Build error after adding a TypeScript file to a Razor Class Library project
(With Visual Studio 17.14.13) Steps to reproduce (sorry this is a bit long but these are the fewest steps I could find):
From the command line, create the solution folder:
md test1
cd test1
Create ...
1
vote
1
answer
136
views
Manually added Razor page doesn't render razor component
I started a project as .NET Minimal API - no UI whatsoever. Then I needed to add a visual tool for the API, to show what the service is doing.
For UI I wanted to use Razor pages and components, as it ...
1
vote
1
answer
52
views
ASP.NET Core MVC: How to make simple page with IEnumerable<XML>
I have a simple project where the start page shows a list of books. How to make the same page, but with display as XML?
Controller method:
public IActionResult Index()
{
// stored procedure
...
1
vote
1
answer
58
views
.NET Core Razor Page erroneously invoking OnGet when clicking an anchor tag in _Layout.cshtml
I have an ASP.NET Core Razor C# app.
In the _Layout.cshtml file, I have anchor tags to launch various pages in the form of a menu.
Here is an example:
<a class="nav-link text-dark" asp-...
1
vote
0
answers
36
views
Want to modify the Middleware in razor page to redirect to SessionExpired Page once application times out
I have following AutoLoginMiddleware in my intranet razor page application and want to modify the middleware to redirect to SessionExpired page purposedly once it times out after 30 min (auth cookie ...
0
votes
3
answers
67
views
dropdown menu item doesn't drop down
I have an ASP.NET Core MVC web application. In _layout.cshtml, I have the following code, but it doesn't drop down in the menu bar it shows "manage" with a down arrow next to it below is the ...
0
votes
2
answers
109
views
Errors while compiling Razor content
This is a follow up on Cannot compile a Razor document.
I get several errors while compiling a Razor content (not a file). The code is like this:
var content = File.ReadAllText("RazorComponent....
0
votes
1
answer
73
views
Can I change the height of the popup height of TelerikMultiSelect in Blazor?
So I am trying to do what Telerik can do in their code for the Jquery version but it's not working. See below:
I am trying to do a pretty simple just list of strings but there are about 80 of them ...
0
votes
1
answer
61
views
Cannot compile a Razor document
I am trying to compile a Razor document for which I have the contents, not the file.
Here are my steps:
var content = File.ReadAllText("RazorComponent.razor");
var document = ...
0
votes
2
answers
66
views
Dynamically create 1 div per row when viewing page in mobile device
I know there are many questions similar to this, but I'm not sure how to implement in my case.
In my razor page, I have a @foreach loop that creates several divs next to each other. Since the width's ...
1
vote
0
answers
55
views
Singleton / cascading scoped service using SignalR hub
I have an app where I want to centralise a notification service. With hardware sending out updates of it current status as it changes.
There are a number of separate components which need to react to ...
1
vote
0
answers
76
views
Blazor InputText binding not updating UI with space string is assigned, but works when empty
I can't figure out why if I assign an empty string in the "if" block, everything works and the string and field are updated.But if I remove the space at the end, also changing the variable, ...
0
votes
0
answers
43
views
Razor 9 select dropdown does not show value of model
I am unable to configure a select dropdown to display the value of the model property. I am working from scaffolded pages where i need to use a different control than what the scaffolder chose.
I am ...
1
vote
1
answer
177
views
Is there a way to partially remove minted highlighting in LaTex?
I am using LaTeX for writing a thesis, including the package minted to highlight code. In my case, it is Razor code, which means a mixture of html and C#.
The following code is an example for my ...
0
votes
0
answers
42
views
set conditional tooltip on Kendo UI Grid column
The conditional tooltip is not working on kendo UI Grid column.
The following code is not applying the condition for title and instead showing the whole text
'#= (!IsSynced && !AddressNickname....
1
vote
1
answer
80
views
Validation messages not clearing with resetForm() or $("#myForm")[0].reset()
I'm trying to understand how input validation works. In the HTML below, btnconfirm triggers the validation errors and resetForm resets the form.
resetForm clears the input boxes, but doesn't clear the ...
1
vote
1
answer
73
views
Creating a Razor component from a string
Razor components are normally loaded from .razor files. Behind the scenes, they implement the IComponent interface (or one of its implementations).
What I'd like to know is, can we build a Razor ...
0
votes
0
answers
26
views
Is "data-val-required" supposed to display message when required validation fails?
The cshtml for my modal dialog has two input forms. When I click on "Submit" the required attributes for the input forms are working since the ajax call is not invoked unless both inputs ...
1
vote
2
answers
197
views
input forms or class properties with Required attribute not stopping ajax call
This has been a slow step-by-step process for me, but I'm getting there.
My modal popup has two input forms that need to be filled out before the ajax call is executed. I've tried a few options, ...
2
votes
1
answer
78
views
Calling server-side method with AJAX from button in dynamic divs
I'm learning how to call C# code from a razor page with AJAX, so please bear with me.
In the html, I create a container of divs based on a foreach loop. The divs are created correctly and the modal ...
0
votes
2
answers
60
views
Change default width of jquery dialog popup in CSHML?
I've been searching for a way to increase the width of the modal popup in my cshtml, but haven't been able to. I tried the suggestions in this SO question, but none worked.
Here's my code. Doesn't ...
0
votes
1
answer
49
views
Modal popup not showing within foreach divs but is displayed outside of the divs
So I've been learning asp.net core and razor, and it's been awesome. I finally created the div structure bound to my sql data, and that was pretty cool.
My next step is to display a modal popup when I ...
0
votes
5
answers
113
views
Display several cells per row?
I'm learning how to use razor, so please bear with me.
I'm trying to create a simple grid that shows our products. Each row will display several products, and each product will display the name, the ...
0
votes
0
answers
50
views
MudBlazor Drag&Drop between MudTable and MudDropZone
I have the razor page (with MudBlazor) with a MudTable at the top. The table displays . Beneath that, I have a grid of MudDropZones, rooms as columns and roles as rows. I called it . So a person has a ...
0
votes
0
answers
30
views
ASP.NET Razor Send HTTP Request via HttpClient and include JWT Auth Browser cookies
I have a WebApi and Razor frontend project (both using .Net 8.0). I'm trying to learn to implement authentication using JWT and cookies.
As of now it is working well:
Login on my razor website, which ...
0
votes
1
answer
83
views
Razor - Convert DataTable to Array in JavaScript
I have a datatable in Razor Project with rows containing id, name, title, parent, and other fields. I need to bind a JavaScript array dynamically, but I tried this code and got an error. Please help.
...
0
votes
0
answers
54
views
DataTable is always empty in ASP.NET MVC
I am working with jQuery datatables, but the datatable is always empty when the page loads. On inspecting the network tab, the request returns an empty response but when debugging the controller ...
1
vote
1
answer
127
views
I have problem to save new data in database using EF Core in ASP.NET Core
I want to create a test website for recording a company's information. After running the software and entering three data entries, everything goes well. However, after registering the fourth data ...
0
votes
0
answers
29
views
How to treat RazorLight templates as Razor views at build-time for validation, but use RazorLight at runtime?
I'm working on an ASP.NET clean architecture project that uses Azure Functions to send emails. The email templates are stored in Services/EmailService/Template/ with each template using @model to bind ...
0
votes
0
answers
43
views
Blazor/Razor auto formatting identation in Visual Studio
I'd like to customize the way Visual Studio auto formats Blazor/Razor components.
Usually, it formats wrapped tags like this:
<SomeComponentWithSomeRandomName @bind-Checked="@this.YesConfirmIt&...
0
votes
1
answer
73
views
'HttpNavigationManager' not initialized when rendering static HTML
I'm trying to generate HTML to a string from a Razor component. I use the following code to do that:
var html = await _htmlRenderer.Dispatcher.InvokeAsync(async () =>
{
var pv = ...
0
votes
0
answers
55
views
Issue with InteractiveServer in web app mixing Blazor, Razor and MVC pages in web app
I have .net 9 web app mixing Blazor, Razor and MVC pages. When I use URL with two segments, the InteractiveServer is not working.
Following code displays: Server | true
@page "/blazor"
@...
0
votes
0
answers
22
views
Indexing a collection in CSHTML in ASP.NET Core MVC [duplicate]
I have the following Entity Framework tables:
ChildFile:
- Id (PK)
- ParentId (FK)
- FileName (string)
- [NotMapped] FileEntry (IFormFile)
Parent:
- Id (PK)
- ChildFiles (ICollection&...