ASP.Net [HiddenInput] Data Attribute não funciona quando processado com Html.EditorForModel no Razor?

Eu tenho o seguinte modelo:

public class Product
{
    [HiddenInput(DisplayValue = false)]
    public int ProductID { get; set; }

    [Required(ErrorMessage="Please enter a product name")]
    public string Name { get; set; }

    [Required(ErrorMessage="Please enter a description")]
    [DataType(DataType.MultilineText)]
    public string Description { get; set; }

    [Required]
    [Range(0.01, double.MaxValue, ErrorMessage="Please enter a positive price")]
    public decimal Price { get; set; }

    [Required(ErrorMessage="Please specify a category")]
    public string Category { get; set; }

    public byte[] ImageData { get; set; }

    [HiddenInput(DisplayValue = false)]
    public string ImageMimeType { get; set; }
}

Eu estou referenciandoSystem.Web.Mvc eSystem.ComponentModel.DataAnnotations.

Então, estou traduzindo isso da seguinte maneira:

<h1>Edit @Model.Name</h1>

@using (Html.BeginForm("Edit", "Admin", FormMethod.Post, new { enctype = "multipart/form-data" })) {
@Html.EditorForModel()

<div class="editor-lable">Image</div>
<div class="editor-=field">
    @if (Model.ImageData == null)
    {
        @:None
        }
    else
    {
        <img width="150" height="150" src="@Url.Action("GetImage", "Product", new { Model.ProductID })" />
    }
    <div>Upload new image: <input type="file" name="Image" . /></div>
</div>
<input type="submit" value="Save" />
@Html.ActionLink("Cancel and return to List", "Index")

}

O problema é que enquanto o[Required] anotações estão funcionando corretamente o[HiddenInput] campos não estão realmente se escondendo. A fonte html nem tem o atributo oculto aparecendo.

Porque não éHtml.EditorForModel aplicando o[HiddenInput] Atribuir a essas propriedades? Alguma ideia?

questionAnswers(6)

yourAnswerToTheQuestion