How to exclude a field from @Html.EditForModel() but have it show using Html.DisplayForModel()
I am reading up on ASP.NET MVC and all of it's fun uses and I just found out about DataTemplates . In my hurry to test this thing out, I converted one of my simpler models over to using @Html.DisplayForModel() and @Html.EditForModel() and it worked like a lucky charm that it is :) One thing that I immediately found out though was that I could not easily define a field to show up on display views but not be present at all for editing... You can make use of IMetadataAware interface an create attribute which will set ShowForEdit and ShowForDislay in Metadata: [AttributeUsage(AttributeTargets