Top "Razor" questions

Razor is a template language used by ASP.

Converting DateTime format using razor

What is wrong with the following? @Convert.ToDateTime((@item.Date.ToShortDateString())," dd - M - yy") @item.Date is showing 20/11/2005 12:00 …

asp.net-mvc-3 razor
Writing/outputting HTML strings unescaped

I've got safe/sanitized HTML saved in a DB table. How can I have this HTML content written out in …

asp.net-mvc asp.net-mvc-3 razor
How to get the Display Name Attribute of an Enum member via MVC razor code?

I've got a property in my model called "Promotion" that its type is a flag enum called "UserPromotion". Members of …

c# asp.net-mvc razor displayattribute
How can I pass parameters to a partial view in mvc 4

I have a link like this: <a href='Member/MemberHome/Profile/Id'><span>Profile</span&…

asp.net-mvc asp.net-mvc-4 razor partial-views
dropdownlist set selected value in MVC3 Razor

Here is my model: public class NewsCategoriesModel { public int NewsCategoriesID { get; set; } public string NewsCategoriesName { get; set; } } My controller: public …

asp.net-mvc-3 drop-down-menu razor selected
How to correctly use Html.ActionLink with ASP.NET MVC 4 Areas

I recently discovered Areas in ASP.NET MVC 4, which I have successfully implemented, but I'm running into troubles with the @…

c# asp.net-mvc-4 razor asp.net-mvc-routing
How to reference a .css file on a razor view?

I know how to set .css files on the _Layout.cshtml file, but what about applying a stylesheet on a …

css asp.net-mvc razor
Escape @ character in razor view engine

I am creating a sample ASP.NET MVC 3 site using Razor as view engine. The razor syntax starts with @ character …

asp.net-mvc-3 razor escaping
How to create a readonly textbox in ASP.NET MVC3 Razor

How do I create a readonly textbox in ASP.NET MVC3 with the Razor view engine? Is there an HTMLHelper …

c# asp.net-mvc-3 razor html-helper readonly-attribute