Top "Razor" questions

Razor is a template language used by ASP.

Razor View Without Layout

How come when I have Layout = null; in my view - it still pulls in the default layout?! Is there …

asp.net-mvc asp.net-mvc-3 layout razor
Getting index value on razor foreach

I'm iterating a List<T> in a razor foreach loop in my view which renders a partial. In …

asp.net-mvc asp.net-mvc-2 razor partial-views
Html.HiddenFor value property not getting set

I could have used @Html.HiddenFor(x=> ViewData["crn"]) but, I get, <input id="ViewData_crn_" name="ViewData[…

asp.net-mvc razor viewdata html.hiddenfor
Razor MVC Populating Javascript array with Model Array

I'm trying to load a JavaScript array with an array from my model. Its seems to me that this should …

javascript arrays asp.net-mvc asp.net-mvc-4 razor
The name 'model' does not exist in current context in MVC3

I added a cshtml page in an project. When I tried to add the following declaration to it, I get …

asp.net-mvc-3 razor
How to pass IEnumerable list to controller in MVC including checkbox state?

I have an mvc application in which I am using a model like this: public class BlockedIPViewModel { public string IP { …

c# asp.net-mvc asp.net-mvc-4 razor model-binding
ASP.NET MVC View Engine Comparison

I've been searching on SO & Google for a breakdown of the various View Engines available for ASP.NET MVC, …

asp.net-mvc spark-view-engine viewengine razor
Razor View Engine : An expression tree may not contain a dynamic operation

I have a model similar to this: public class SampleModel { public Product Product { get; set; } } And in my controller I …

asp.net-mvc .net-4.0 razor
ASP.NET MVC razor: conditional attribute in HTML

Code below doesn't seems clean. Any suggestion to improve the code? <li @if(ViewData["pagename"].ToString()=="Business details"){ <…

asp.net-mvc asp.net-mvc-3 razor
MVC 3 file upload and model binding

I have a form upload that works but I would like to pass model information for my database to save …

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