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 my enum have display attributes set as follows: [Flags] public enum UserPromotion { None = 0x0, [Display(Name = “Send Job Offers By Mail”)] SendJobOffersByMail = 0x1, [Display(Name = “Send Job Offers By Sms”)] SendJobOffersBySms = … Read more

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 the following: Adding an entry to the very beginning of my RegisterRoutes method: routes.IgnoreRoute(“favicon.ico”); Placing favicon.ico in the root of my application (which is also going to be the root of my domain). I have two questions: Is … Read more

ASP.NET MVC 3 – Partial vs Display Template vs Editor Template

So, the title should speak for itself. To create re-usable components in ASP.NET MVC, we have 3 options (could be others i haven’t mentioned): Partial View: @Html.Partial(Model.Foo, “SomePartial”) Custom Editor Template: @Html.EditorFor(model => model.Foo) Custom Display Template: @Html.DisplayFor(model => model.Foo) In terms of the actual View/HTML, all three implementations are identical: @model WebApplications.Models.FooObject <!– Bunch … Read more

How do I specify different Layouts in the ASP.NET MVC 3 razor ViewStart file?

I would like to have 2 separate Layouts in my application. Let’s say one is for the Public section of the website and the other is for the Member side. For simplicity, let’s say all the logic for each of these sites is wrapped neatly into 2 distinct controllers. PublicController StaffController And that they each … Read more

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, but haven’t found much more than simple high-level descriptions of what a view engine is. I’m not necessarily looking for “best” or “fastest” but rather some real world comparisons of advantages / disadvantages of the major … Read more