I have this line in my View:
@Html.EditorForModel()
And this is my ViewModel:
public class CommentForm
{
public int Id { get; set; }
[DisplayName("Kommentar"), DataType(DataType.MultilineText)]
public string Comment { get; set; }
}
The problem is that Id renders as a textfield in the form. Actually, I only want to use Id in the form action. Is there an attribute that tells the editor not to render the property Id?
Thanks for your contributions, but I didn’t really like them.
I made my own PreventRenderingAttribute.
PreventRenderingAttribute.cs
And in CommentForm