Skip to main content

Questions tagged [razor]

Razor is a template language used by ASP.NET Web Pages and ASP.NET MVC (since version 3). It supports seamless transitions between HTML markup and C# or VB code. Transitions between markup and code are indicated by the "@" sign.

Filter by
Sorted by
Tagged with
3 votes
1 answer
164 views

The move to MVC and MVVM has not been easy for me. Combining multiple languages in single pages with inline code is something I find disorienting. I'd like to remedy this by attempting to use Razor ...
Northern Scrub's user avatar
2 votes
1 answer
145 views

My main focus is having as little duplicate code/files as possible. Most of the HTML I write is almost identical. There is already a form template which holds the form and several necessities. That ...
Roe's user avatar
  • 131
1 vote
0 answers
241 views

I come from a background in ASP.NET MVC 5 on .NET 4.8. I've been trying to wrap my head around the new razor pages, and can't seem to get routing to work, or understand it, even. I don't want to use ...
Allen Clark Copeland Jr's user avatar
2 votes
2 answers
2k views

An important view in our application is a big table of entities. For the purposes of this question I'll use an analogy for our entities - so let's say it's vehicles. There's half a dozen different ...
KeizerHarm's user avatar
0 votes
0 answers
1k views

I have ASP.NET 5 Web Api and need to do the following task: Add endpoint, which get cshtml page and return generated html, so it should do the same what is does razor view engine. What is better way ...
Alexan's user avatar
  • 249
1 vote
1 answer
78 views

So I have made a pull request to change this code: //Controller: ... [HttpPost] public ActionResult Unauthorize(int userID, int permissionID) { ...
Sarov's user avatar
  • 403
0 votes
0 answers
411 views

Is this a good code pattern in ASP.NET Core Razor Pages, for private methods to return IActionResult to the calling handler? // Public handler public IActionResult OnGet() { var result = ...
Nick's user avatar
  • 109
13 votes
4 answers
10k views

The distinction between roles and claims is that roles describe a set of users and claims describe a property of a user. So there can be a role "Administrator", but there can also be a claim "...
FCin's user avatar
  • 532
1 vote
1 answer
116 views

We have an MVC application that has very granular and configurable authorization. We currently have been using the authorize attribute against our controllers and controller functions. The next ...
Leonardo's user avatar
  • 119
0 votes
1 answer
122 views

I have a website where I want to have a partial view on the page that contains a Singleton service. I am trying to do this with Razor Pages, and have tried Partial Views and ViewComponents, but ...
Isaac Levin's user avatar
7 votes
1 answer
4k views

Was doing some reading today about Razor Syntax with MVC Framework and was wondering why would/should I use Razor? What benefit does it provide over doing the same thing in the code behind and/or ...
ggiaquin16's user avatar
1 vote
0 answers
731 views

I have an application written is C# ASP.NET MVC 4 with Razor views. I am a bit stuck on my menu structure. As per the image above, one can see that there is a Top Menu and a Side Menu. The standard ...
Shane van Wyk's user avatar
23 votes
4 answers
11k views

My question is related to MVC design pattern and Razor Syntax introduced by Microsoft. While learning MVC design pattern I was told that the idea is based upon a principle known as Separation of ...
John Strowsky's user avatar
0 votes
0 answers
975 views

I want to build a template engine (ITT not another template engine...) based on Razor. I've been at it for quite a long time not getting anywhere and quite frankly I'm at my limit. I've tried rolling ...
Daryl Teo's user avatar
  • 111
6 votes
2 answers
21k views

Actually, I already have at least 3 different solutions for the problem, I just don't like any of them for various reasons. In ASP.NET MVC/Razor, there are no controls anymore, in the sense as they ...
fejesjoco's user avatar
  • 603
-2 votes
3 answers
867 views

I just started a new job, I have to create a web app for them and host it on their intranet on an Windows 2003 R2 server with SQL server 2008. As said in the question, I'll work on a MCV3 with Razor ...
Poutchyouk's user avatar
1 vote
1 answer
212 views

It was suggested on my Stack Overflow question that this might be better suited to this site, so I'm cross-posting it. I'm working on my first ground-up build of an MVC site. I have a collection of ...
Jeff's user avatar
  • 131
0 votes
1 answer
2k views

In an ASP.NET MVC project (Razor), I have a Get request, which loads two properties on a model, dependent on the property passed into the action method. So if the parameter has a value, the Group ...
Brian Mains's user avatar
0 votes
3 answers
4k views

This is more of a "how would you do it" type of question. The application I'm working on is an ASP.NET MVC4 app using Razor syntax. I've got a nice domain model which has a few polymorphic classes, ...
Johann's user avatar
  • 1
9 votes
6 answers
9k views

I'm in the early stages in the design of a system that will essentially be split into two parts. One part is a service and the other is an interface with the service providing data through something ...
Daniel Little's user avatar