Questions tagged [razor]
Razor is a template language used by ASP.NET Web Pages, ASP.NET MVC (since version 3), and ASP.NET Core. It adds a layer of abstraction above HTML generation. It supports seamless transitions between HTML markup and C# or VB code. Transitions between markup and code are indicated by the "@" sign.
razor
33,309
questions
0
votes
0
answers
32
views
ASP.NET Core Razor page async OnGet handler causing intermittent errors if not set to return a Task
In my async OnGet Razor page handler I'm calling async methods (all awaited) that populate the Razor page model used in the Razor view for rendering content. What I noticed is that until I turned the ...
0
votes
1
answer
83
views
MudBlazor - Page layouting
I am currently trying to create a MudBlazor WebApp.
As I am quite new to MudBlazor I try to figure out how the spacing and page layouting works.
So i took a very basic layout from the MudBlazor ...
1
vote
1
answer
24
views
How to disable decimals in Kendo NumericTextBox
<kendo-numerictextbox id="example1" name="example1" value="@Model.Example1" min="0" format="n0" decimals="0" data-bind="value: ...
0
votes
2
answers
56
views
Form in foreach in Razor view: Validation is shown to all the elements
Consider the following Razor code
foreach(Person p in Model.Persons){
<form>
@Html.TextBoxFor(m => p.Name)
@Html.ValidationMessageFor(m => p.Name)
@Html....
4
votes
3
answers
687
views
Blazor (WA .NET6)- TS1109 Error, how to fix it?
I've been working on a Blazor WebAssembly .NET6 project for a couple of years.
I updated VS2022 recently to the latest 17.10.0(I was in the previous 16.9 before), and after that I'm having TS1109 all ...
0
votes
2
answers
83
views
ArgumentException on async get method in repository. ASP.NET Core - Razor Pages
I'm asking this question because I haven't found any solution. I rewrote my code multiple times by tutorials but nothing changed.
Broken query method in ReadRepository.cs:
public async Task<T> ...
1
vote
1
answer
47
views
Using SignalR in a RAZOR OnPost method to update the client page with status
In my RAZOR web app I want to update the client page with the progress as an OnPost method executes in the server. I have seen the example using SignalR to blast a message to all the clients and have ...
0
votes
2
answers
60
views
Dynamically pass ID of a control to a C# function on onchange event
I am converting an existing ASP.NET application into Blazor app.
I have this form
<table width='400px' style="border-width:2" ><!-- Start Hub table
<tr>
...
0
votes
1
answer
17
views
Can I differentiate between ErrorMessage and diplayed error text in Razor pages
I'm coming from a Web Forms background and attempting to learn Razor pages. In Web Forms, I use the asp:Validation controls pretty extensively. These validation controls give me the option to specify ...
0
votes
3
answers
94
views
How to pass value from controller to view and display it in a text field or label
I am a bit stuck trying to figure out on how to show the value of a field model.SumValue which I am calculating in the controller class in a input field or a label.
Controller class -
public ...
1
vote
0
answers
117
views
Navigation to file on parameter with Custom Helpers for cshtml
I have a custom helper @Url.Content("./customfolder/typescript.ts", ContentExtension.ToJs) that alters the file and directory. But I lose the functionality to navigate to the original file.
...
0
votes
0
answers
43
views
Is there a way to convert a List of type IFormFile to IFormFileCollection
In my code I have a OnPost() method that recieves an IFormCollection, through this I pass a few files through. One of these files I always want to always be the the index[0] of a List<byte[]>. ...
0
votes
0
answers
39
views
Cannot see any changes i made in the cshtml file on browser
I'm a newbie in programming (17 y.o), and I am currently struggling with ASP.NET. When I create a .cshtml file and try to test it in the browser, I see the default interface that Microsoft provides. ...
1
vote
1
answer
65
views
HTML elements go black when loading
After going black they momentarily go back to normal.
Loading....
Here is the code of the navbar.
@using Microsoft.AspNetCore.Mvc.TagHelpers
<!DOCTYPE html>
<html lang="en">
&...
1
vote
2
answers
67
views
InvalidOperationException: The view 'AddValue' was not found. Partial View not found when submitting form data
I'm trying to insert data into two table from a single View Page. I've used two different view model to do that. So I have to make a partial view for inserting data in second table. Now full page is ...