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
82
votes
5
answers
28k
views
Emitting unencoded strings in a Razor view
As ScottGu says in his blog post «by default content emitted using a @ block is automatically HTML encoded to better protect against XSS attack scenarios».
My question is: how can you output a non-...
-1
votes
3
answers
683
views
Razor wishlist - what would you like to be implemented? [closed]
Razor view engine looks promising, so I thought it would be good to contribute with ideas and compile a wish-list of Razor features while the development is just in preview stage.
What are the ...
9
votes
3
answers
10k
views
Formatting strings in ASP.NET Razor
I am currently writing a small templating system in ASP.NET to allow users to add content. For example, the user can enter the string (variable type is string).
topHeader[x] = "They think it's all ...
1
vote
6
answers
3k
views
"Object reference not set to an instance of an object" when initialising multi-dimensional array
I am running the following code on an ASP.NET razor page (cshtml) and am suffering the dreaded "Object reference not set to an instance of an object" problem. Could someone help me out with this ...
11
votes
3
answers
6k
views
Can we use Razor on an existing ASP.NET 4 website?
Is it possible to use Razor on an existing ASP.NET 4 website?
8
votes
4
answers
9k
views
installing the razor view engine for Visual Studio
I just downloaded and installed Web Matrix beta.
I am really liking the razor view engine.
Not so much the Web Matrix IDE.
Is there any way to install razor view engine for use in the Visual Studio ...
786
votes
12
answers
331k
views
How do I import a namespace in Razor View Page?
How to import a namespace in Razor View Page?
5
votes
1
answer
2k
views
intellisense with razor and VS 2010
Is there any way to get intellisense with razor in VS 2010, I am working on an application with web matrix and launched VS 2010 from WebMatrix.
4
votes
1
answer
360
views
Where are the Razor assemblies?
I'm playing around with WebMatrix and I'd just like to explore some of the razor stuff behind the scenes... but my Reflector skills (and my brain) are failing me. Does anyone know offhand what ...
5
votes
5
answers
2k
views
WebMatrix, ASP.NET Razor, IIS Developer Express, SQL Server Compact Edition - What is Microsoft objective behind these new technologies?
Recently Microsoft (via Scottgu) has announced some new technologies (WebMatrix, ASP.NET Razor, IIS Developer Express, SQL Server Compact Edition). I think this is something new direction in which ...
18
votes
3
answers
4k
views
How do you set the content type for a WebMatrix/Razor Response?
I'd like to return some XML instead of HTML in my WebMatrix cshtml file? How do you change the content type header?
41
votes
6
answers
19k
views
ASP.NET MVC Razor view engine
After reading Scott Guthrie's blog entry about the new Razor view engine for ASP.NET MVC and reading this question comparing the available view engines.
Razor seems to address most of the problems ...
22
votes
5
answers
14k
views
Client Id for Property (ASP.Net MVC)
I'm trying to do a label for a TextBox in my View and I'd like to know, how can I take a Id that will be render in client to generate scripts... for example:
<label for="<%=x.Name.ClientId%>"...
57
votes
5
answers
70k
views
how to access querystring in ASP.Net MVC View?
How do I access the querystring value in a View?
134
votes
14
answers
76k
views
Get Current Area Name in View or Controller
How do you get the current area name in the view or controller?
Is there anything like ViewContext.RouteData.Values["controller"] for areas?