How can I make a default editor template for enums? By which I mean: can I do something like this:
<%@ Control Language=\"C#\" Inherits=\"System.Web.Mvc.V
Late to answer but I hope this helps others. Ideally you want all enums to use your Enum template by convention, not by specifying a UIHint each time, and you can accomplish that by creating a custom model metadata provider like this:
using System;
using System.Collections.Generic;
using System.Web.Mvc;
public class CustomMetadataProvider : DataAnnotationsModelMetadataProvider
{
protected override ModelMetadata CreateMetadata(IEnumerable attributes, Type containerType, Func
Then simply register it in the Application_Start method of Global.asax.cs:
ModelMetadataProviders.Current = new CustomMetadataProvider();
Now all your enum properties will use your Enum template by default.