Top "Razor" questions

Razor is a template language used by ASP.

ASP.NET MVC Razor pass model to layout

What I see is a string Layout property. But how can I pass a model to layout explicitly?

c# .net asp.net-mvc razor
Differences between Html.TextboxFor and Html.EditorFor in MVC and Razor

Why by default were these changed when adding a new "edit" view? What are advantages when using EditorFor() vs. TextboxFor()? …

asp.net-mvc asp.net-mvc-3 razor
How can I add a class attribute to an HTML element generated by MVC's HTML Helpers?

ASP.NET MVC can generate HTML elements using HTML Helpers, for example @Html.ActionLink(), @Html.BeginForm() and so on. I …

asp.net-mvc razor html-helper
Action Image MVC3 Razor

What is the best way to replace links with images using Razor in MVC3. I simply doing this at the …

image asp.net-mvc-3 action razor
How to get query string parameter from MVC Razor markup?

I want to check the URL parameter in my Razor markup. For example, how do I do something like this: &…

c# asp.net asp.net-mvc razor asp.net-mvc-4
How to write a comment in a Razor view?

How to write a comment in a MVC view, that won't be transmitted to the final HTML (i.e.,to …

c# asp.net-mvc-3 razor comments
Razor If/Else conditional operator syntax

Not having much luck, I have the following if/else statement in Razor which works perfectly <small> @if(…

asp.net-mvc-3 razor
Serving favicon.ico in ASP.NET MVC

What is the final/best recommendation for how to serve favicon.ico in ASP.NET MVC? I am currently doing …

asp.net asp.net-mvc razor favicon
How to set value in @Html.TextBoxFor in Razor syntax?

I have created an text-box using Razor and trying to set value as follows. @Html.TextBoxFor(model => model.Destination, …

.net asp.net-mvc asp.net-mvc-3 razor html.textboxfor
Where and how is the _ViewStart.cshtml layout file linked?

Here's the About.cshtml from the default MVC 3 template: @{ ViewBag.Title = "About Us"; } <h2>About</h2> &…

.net asp.net-mvc asp.net-mvc-3 razor