Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

1
vote
0answers
12 views

Any Performance issue if render partial is used within a parent view

Is there any performance implication if we move the codes of view to a partial view and render the partial view from the parent view like the following: @Html.Raw(ProcessContent(Html.Partial("...
1
vote
3answers
926 views

Should it be a claim, a role or a policy?

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 "...
1
vote
1answer
44 views

What is the best way to implement model property authorization in an ASP MVC?

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 ...
0
votes
1answer
57 views

Best Approach to have a shared view

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 ...
6
votes
1answer
4k views

Why use Razor Syntax?

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 ...
1
vote
0answers
499 views

Top Menu bar driving a sidebar sub menu

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 ...
22
votes
4answers
10k views

If MVC is “Separation of Concerns” then why was Razor Syntax introduced?

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 ...
0
votes
0answers
830 views

Parsing Razor-style Templates

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 ...
5
votes
2answers
19k views

In ASP.NET MVC/Razor, how to add initializer JavaScript to a “control”?

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 ...
-2
votes
3answers
834 views

Host an MVC 3 with Razor syntax app on old server [closed]

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 ...
1
vote
1answer
182 views

Primer on moving around in MVC

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 ...
0
votes
1answer
2k views

Get/Post Controller Logic Best Practice

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 ...
0
votes
3answers
3k views

How to build MVC Views that work with polymorphic domain model design?

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, ...
9
votes
6answers
9k views

Is Razor or XSLT better for my project? [closed]

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 ...