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,300
questions
0
votes
1
answer
21
views
jquery validate make one field required if another field is not empty
I'm having some issues with jQuery.validate 1.11 , with .Net 4.8 and MVC 5 with Razor.
I have these two properties in my class:
[StringLength(500, ErrorMessage = "{0} can have a max of {1} ...
0
votes
1
answer
17
views
RadzenDataGrid does not reload after data property is updated or changed
I'm having a problem that I can't get my head around. I've read numerous articles online and nobody appears to have come across any solution which works for me.
Goal
I want to display a file selector, ...
0
votes
0
answers
44
views
How do I make the input type radio so that it can be checked?
I have the problem that when I insert the check to the first one and then I insert another one and the check is passed to the new one that is entered and the idea is that it stays there in the first ...
0
votes
0
answers
24
views
How I can ensure that my async method properly returns into main UI thread?
I've got a Razor Component running on Blazor WASM. It sends an asynchronous request to the IoT device to get data type of some node. If it isn't the same as the stored one, I'll ask the user to update ...
0
votes
0
answers
7
views
Setting On in dropdown semantic ui don´t work
I'm trying in my dropdown, which already works, allowing it to only perform the search when the "Search" button is clicked.
I saw in the semantic Ui documentation that there is an "On&...
0
votes
1
answer
31
views
How to create dropdown in mvc to select object
As we can select object in angular, is there any way that I make asp.net Dropdown to select the object.
I have a list in which there is Id, CountryName, CurrencyCode. I want CurrencyCode to be ...
0
votes
2
answers
43
views
How to get container of model in EditorTemplate, ASP.NET Core 8.0
I'm looking for possibility to retrieve container in EditorTemplate (ASP.NET Core 8.0).
In .NET 4.6 there is property for that:
ViewData.ModelMetadata.Container
but there is no such property in .NET ...
0
votes
0
answers
11
views
DNN Razor Host Module - How to use a querystring parameter as a variable to get data related to a specific UserID
I need a syntax help to write the following code to use in Host Razor module on a dnn site version 9.13.
I need to use a querystring parameter as a variable to get data related to a specific UserID.
@...
2
votes
1
answer
36
views
Strange Strings in HTML Code of New ASP.NET Core Razor Projects in Visual Studio 2022
I'm encountering an issue when creating new ASP.NET Core web app (Razor) projects using Visual Studio 2022 (Community Edition 17.10.4) with .NET 8.0. Without making any modifications, I see strange ...
1
vote
1
answer
40
views
Different authorization for one folder page than for the rest of the folder in ASP.NET Core Razor
Using ASP.NET Core identity, I'd like to allow an authorized user ability to change their password, but require the policy "Admin" access to access the other Account Manage pages.
However, ...
0
votes
1
answer
38
views
dropdown MVC don't keep focus for selected option
I have asp net core mvc application. After clicking filter controller recives propper data, but drop down always shows All option:
@{
ViewData["Title"] = "Index";
IsOpenFilterState ...
0
votes
0
answers
32
views
In one of the cshtml files,namespaces can not be found
I am using visual studio 2022 .net 6. All the other cshtml files within the same project are not showing any issues. Only in one cshtml file, the namespaces are not able to be found. All the ...
0
votes
1
answer
49
views
How to populate CreateGroupViewModel
I'm having trouble with inputting value into a ViewModel as it keep returning null after the value is inputted via cshtml.
Value I input in cshtml
After hitting confirm
CreateViewModel.cs
public ...
0
votes
1
answer
32
views
How do I use cshtml links inside a controller class?
I have an older ASP.NET Core 2.1 web app project.
I have a .cshtml page in this folder in my project:
G:\Projects\AccessApp\Pages\Privacy.cshtml
And I want to use it in my controller. I've tried the ...
1
vote
1
answer
34
views
How to conditionally render style attribute in Razor template without causing NullReferenceException?
I am working on a templating project using C# and Razor Engine (Razor Templating Engine). The objective is to create React code using my own JSON definition.
My AppDefinition.json looks like this when ...