Skip to main content

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
0 votes
2 answers
35 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 ...
Jerzy P's user avatar
0 votes
0 answers
8 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. @...
Lu Ma's user avatar
  • 1
2 votes
1 answer
28 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 ...
hamid reza's user avatar
1 vote
1 answer
32 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, ...
Greg L.'s user avatar
  • 11
0 votes
1 answer
34 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 ...
Maciek's user avatar
  • 171
0 votes
0 answers
29 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 ...
Hchavan's user avatar
0 votes
1 answer
45 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 ...
Trung Đặng Đức's user avatar
0 votes
1 answer
31 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 ...
SkyeBoniwell's user avatar
  • 6,925
1 vote
1 answer
33 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 ...
Harsha W's user avatar
  • 3,316
1 vote
1 answer
48 views

Blazor properly updating the UI after an API call

This code does exactly what I want: Displays a message (div) from the robot saying thinking Waits for the API call to complete updates that message (div) and scrolls to the message (div) It feels ...
Carter's user avatar
  • 734
0 votes
1 answer
39 views

How to avoid bootstrap labels to overflow the date picker input on .NET 8?

I'm following the Microsoft Identity tutorial on adding custom attributes to the identity user. I've added the proposed changes by the microsoft docs, however I'm getting a small visual error. Code is ...
Dancing Diplodocus's user avatar
0 votes
1 answer
29 views

Memory leak after adding AddApplicationPart and EmbeddedFileProvider

I have an ASP.NET Core 8.0 application where I want to move some controllers into a module (separate project). To accomplish this I had to update the startup from: services.AddControllersWithViews() ...
Erik Steinebach's user avatar
0 votes
0 answers
30 views

ASP.NET MVC datepicker doesn't show calendar

I'm trying to add datepicker, however when I try to use @html.TextboxFor, the calendar is not popping up. As for EditorFor to input="date" options, they show mm/dd/yyyy format when I need dd/...
DeP.'s user avatar
  • 1
1 vote
1 answer
47 views

Conditional not working in ASP.NET Core 7 Razor view

I have a search function on my site, and one of the options the user has is to select the type of search. So given this example in a view: @using System.Data @model DataSet hello, world <br /> @...
Lisa's user avatar
  • 75
0 votes
1 answer
39 views

How to use razor renderer in .NET 6?

In my .NET 4.8 Web API application, I take an externally received HTML formatted string and convert it to a .cshtml file using Razor Engine, then append it to my page with JavaScript. I do this using ...
Emre Ceylan's user avatar

15 30 50 per page
1
2 3 4 5
2220